java.io
Class FilterOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
Direct Known Subclasses:
BufferedOutputStream, DataOutputStream, PrintStream

public class FilterOutputStream
extends OutputStream

Abstract class representing a filtered output stream of bytes. This class is the basis for enhancing output stream functionality. It allows multiple output stream filters to be chained together, each providing additional functionality.


Field Summary
protected  OutputStream out
          The actual output stream.
 
Constructor Summary
FilterOutputStream(OutputStream out)
          Creates an output stream filter.
 
Method Summary
 void close()
          Closes the stream.
 void flush()
          Flushes the stream.
 void write(byte[] b)
          Writes an array of bytes.
 void write(byte[] b, int off, int len)
          Writes a subarray of bytes.
 void write(int b)
          Writes a byte.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected OutputStream out
The actual output stream.

Constructor Detail

FilterOutputStream

public FilterOutputStream(OutputStream out)
Creates an output stream filter.

Parameters:
out - the output stream
Method Detail

write

public void write(int b)
           throws IOException
Writes a byte. Will block until the byte is actually written.

Specified by:
write in class OutputStream
Parameters:
b - the byte
Throws:
IOException - If an I/O error has occurred.

write

public void write(byte[] b)
           throws IOException
Writes an array of bytes. Will block until the bytes are actually written.

Overrides:
write in class OutputStream
Parameters:
b - the data to be written
Throws:
IOException - If an I/O error has occurred.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Writes a subarray of bytes. To be efficient it should be overridden in a subclass.

Overrides:
write in class OutputStream
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.

flush

public void flush()
           throws IOException
Flushes the stream. This will write any buffered output bytes.

Overrides:
flush in class OutputStream
Throws:
IOException - If an I/O error has occurred.

close

public void close()
           throws IOException
Closes the stream. This method must be called to release any resources associated with the stream.

Overrides:
close in class OutputStream
Throws:
IOException - If an I/O error has occurred.