CHAPTER 22: The Package java.io Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

22.20 The Class java.io.BufferedOutputStream

22.20.1 buf , 22.20.2 count , 22.20.3 BufferedOutputStream , 22.20.4 BufferedOutputStream , 22.20.5 write , 22.20.6 write , 22.20.7 write , 22.20.8 flush

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 class BufferedOutputStream extends FilterOutputStream {
	protected byte[] buf;
	protected int count;
	public BufferedOutputStream(OutputStream out);
	public BufferedOutputStream(OutputStream out, int size);
	public void write(int b) throws IOException;
	public void write(byte[] b)
		throws IOException, NullPointerException;
	public void write(byte[] b, int off, int len)
		throws IOException, NullPointerException,
			IndexOutOfBoundsException;
	public void flush() throws IOException;
}


22.20.1 buf

protected byte[] buf;

The internal buffer array.


22.20.2 count

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 BufferedOutputStream

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 BufferedOutputStream

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 write

public void write(int b) throws IOException

See the general contract of the write method of OutputStream (S22.15.1).

Overrides the write method of FilterOutputStream (S22.19.3).


22.20.6 write

public void write(byte[] b)
	throws IOException, NullPointerException

See the general contract of the write method of OutputStream (S22.15.2).

Overrides the write method of FilterOutputStream (S22.19.4).


22.20.7 write

public void write(byte[] b, int off, int len)
	throws IOException, NullPointerException,       IndexOutOfBoundsException

See the general contract of the write method of OutputStream (S22.15.3).

Overrides the write method of FilterOutputStream (S22.19.5).


22.20.8 flush

public void flush() throws IOException

See the general contract of the flush method of OutputStream (S22.15.4).

Overrides the flush method of FilterOutputStream (S22.19.6).

Top© 1996 Sun Microsystems, Inc. All rights reserved.