A BufferedOutputStream
adds functionality to another output stream, namely
the ability to buffer the output. When the BufferedOutputStream
is created, an
internal buffer array is created. As bytes are written to the stream, they are stored
in the internal buffer, which is flushed as necessary, thereby performing output to
the contained output stream in large blocks rather than a byte at a time.
public classBufferedOutputStream
extends FilterOutputStream { protected byte[]buf
; protected intcount
; publicBufferedOutputStream
(OutputStream out); publicBufferedOutputStream
(OutputStream out, int size); public voidwrite
(int b) throws IOException; public voidwrite
(byte[] b) throws IOException, NullPointerException; public voidwrite
(byte[] b, int off, int len) throws IOException, NullPointerException, IndexOutOfBoundsException; public voidflush
() throws IOException; }
22.20.1 protected byte[] buf;
22.20.2 protected int count;
This value is always in the range 0
through buf.length
; elements buf[0]
through buf[count-1]
contain valid byte data.
22.20.3 public BufferedOutputStream(OutputStream out)
This constructor initializes a newly created BufferedOutputStream
by saving its
argument, the input stream out
, for later use. An internal buffer array is created
and stored in buf
.
22.20.4 public BufferedOutputStream(OutputStream out, int size)
This constructor initializes a newly created BufferedOutputStream
by saving its
argument, the input stream out
, for later use. An internal buffer array of length
size
is created and stored in buf
.
22.20.5 public void write(int b) throws IOException
See the general contract of the write
method of OutputStream
(§22.15.1).
Overrides the write
method of FilterOutputStream
(§22.19.3).
22.20.6 public void write(byte[] b)
throws IOException, NullPointerException
See the general contract of the write
method of OutputStream
(§22.15.2).
Overrides the write
method of FilterOutputStream
(§22.19.4).
22.20.7 public void write(byte[] b, int off, int len)
throws IOException, NullPointerException, IndexOutOfBoundsException
See the general contract of the write
method of OutputStream
(§22.15.3).
Overrides the write
method of FilterOutputStream
(§22.19.5).
22.20.8 public void flush() throws IOException
See the general contract of the flush
method of OutputStream
(§22.15.4).
Overrides the flush
method of FilterOutputStream
(§22.19.6).