java.io
Class BufferedOutputStream
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--java.io.BufferedOutputStream
This class accumulates bytes written in a buffer instead of immediately
writing the data to the underlying output sink. The bytes are instead
as one large block when the buffer is filled, or when the stream is
closed or explicitly flushed. This mode operation can provide a more
efficient mechanism for writing versus doing numerous small unbuffered
writes.
Author:- Aaron M. Renn (arenn@urbanophile.com)
synchronized void | flush()
|
synchronized void | write(int b)
|
synchronized void | write(byte[] buf, int offset, int len)
|
buf
protected byte[] buf
This is the internal byte array used for buffering output before
writing it.
count
protected int count
This is the number of bytes that are currently in the buffer and
are waiting to be written to the underlying stream. It always points to
the index into the buffer where the next byte of data will be stored
BufferedOutputStream
public BufferedOutputStream(java.io.OutputStream out)
This method initializes a new BufferedOutputStream
instance
that will write to the specified subordinate OutputStream
and which will use a default buffer size of 512 bytes.
Parameters:
BufferedOutputStream
public BufferedOutputStream(java.io.OutputStream out, int size)
This method initializes a new BufferedOutputStream
instance
that will write to the specified subordinate OutputStream
and which will use the specified buffer size
Parameters:
flush
public synchronized void flush()
This method causes any currently buffered bytes to be immediately
written to the underlying output stream.
Throws:
write
public synchronized void write(byte[] buf, int offset, int len)
This method writes len
bytes from the byte array
buf
starting at position offset
in the buffer.
These bytes will be written to the internal buffer. However, if this
write operation fills the buffer, the buffer will be flushed to the
underlying output stream.
Parameters:
Throws:
write
public synchronized void write(int b)
This method writes a single byte of data. This will be written to the
buffer instead of the underlying data source. However, if the buffer
is filled as a result of this write request, it will be flushed to the
underlying output stream.
Parameters:
Throws: