Package java.io |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
public class java.io.BufferedOutputStream extends java.io.FilterOutputStream { // Fields protected byte buf[]; protected int count; // Constructors public BufferedOutputStream(OutputStream out); public BufferedOutputStream(OutputStream out, int size); // Methods public void flush(); public void write(byte b[], int off, int len); public void write(int b); }
The class implements a buffered output stream. By setting up a such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written. The data is written into a buffer, and then written to the underlying stream if the buffer reaches its capacity, the buffer output stream is closed, or the buffer output stream is explicity flushed.
protected byte buf[]The buffer where data is stored.
protected int countThe number of valid bytes in the buffer.
public BufferedOutputStream(OutputStream out)Creates a new buffered output stream to write data to the specified underlying output stream with a default 512-byte buffer size.
Parameter Description out the underlying output stream
public BufferedOutputStream(OutputStream out, int size)Creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size.
Parameter Description out the underlying output stream size the buffer size
public void flush()throws IOExceptionFlushes this buffered output stream. This forces any buffered output bytes to be written out to the underlying output stream .
Throw:
If an I/O error occurs.
Overrides:
flush in class FilterOutputStream .
public void write(byte b[], int off, int len)throws IOExceptionWrites len bytes from the specified byte array starting at offset off to this buffered output stream.
Parameter Description b the data off the start offset in the data len the number of bytes to write Throw:
If an I/O error occurs.
Overrides:
write in class FilterOutputStream .
public void write(int b)throws IOExceptionWrites the specified byte to this buffered output stream.
Parameter Description b the byte to be written Throw:
If an I/O error occurs.
Overrides:
write in class FilterOutputStream .