Class java.io.BufferedOutputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.io.BufferedOutputStream

java.lang.Object
|
   +----java.io.OutputStream
|
           +----java.io.FilterOutputStream
|
                   +----java.io.BufferedOutputStream

public class BufferedOutputStream
extends FilterOutputStream
A buffered output stream. This stream lets you write characters to a stream without causing a write every time. The data is first written into a buffer. Data is written to the actual stream only when the buffer is full, or when the stream is flushed.

Variable Index

 o buf
The buffer where data is stored.
 o count
The number of bytes in the buffer.

Constructor Index

 o BufferedOutputStream(OutputStream)
Creates a new buffered stream with a default buffer size.
 o BufferedOutputStream(OutputStream, int)
Creates a new buffered stream with the specified buffer size.

Method Index

 o flush()
Flushes the stream.
 o write(byte[], int, int)
Writes a subarray of bytes.
 o write(int)
Writes a byte.

Variables

 o buf
protected byte buf[]
The buffer where data is stored.
 o count
protected int count
The number of bytes in the buffer.

Constructors

 o BufferedOutputStream
public BufferedOutputStream(OutputStream out)
Creates a new buffered stream with a default buffer size.
Parameters:
out - the output stream
 o BufferedOutputStream
public BufferedOutputStream(OutputStream out,
                              int size)
Creates a new buffered stream with the specified buffer size.
Parameters:
out - the output stream
size - the buffer size

Methods

 o write
public synchronized void write(int b) throws IOException
Writes a byte. This method will block until the byte is actually written.
Parameters:
b - the byte to be written
Throws: IOException
If an I/O error has occurred.
Overrides:
write in class FilterOutputStream
 o write
public synchronized void write(byte b[],
                                 int off,
                                 int len) throws IOException
Writes a subarray of bytes.
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Throws: IOException
If an I/O error has occurred.
Overrides:
write in class FilterOutputStream
 o flush
public synchronized void flush() throws IOException
Flushes the stream. This will write any buffered output bytes.
Throws: IOException
If an I/O error has occurred.
Overrides:
flush in class FilterOutputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index