Known Direct Subclasses
Base64OutputStream |
An OutputStream that does Base64 encoding on the data written to
it, writing the resulting data to another OutputStream. |
BufferedOutputStream |
Wraps an existing OutputStream and buffers the output. |
CheckedOutputStream |
The CheckedOutputStream class is used to maintain a running checksum
of all data written to a stream. |
CipherOutputStream |
This class wraps an output stream and a cipher so that write methods
send the data through the cipher before writing them to the underlying output
stream. |
DataOutputStream |
Wraps an existing OutputStream and writes big-endian typed data to it. |
DeflaterOutputStream |
This class provides an implementation of FilterOutputStream that
compresses data using the DEFLATE algorithm. |
DigestOutputStream |
DigestOutputStream is a FilterOutputStream which maintains an
associated message digest. |
InflaterOutputStream |
An OutputStream filter to decompress data. |
PrintStream |
Wraps an existing OutputStream and provides convenience methods for
writing common data types in a human readable format. |
|
Known Indirect Subclasses
GZIPOutputStream |
The GZIPOutputStream class is used to write data to a stream in the
GZIP storage format. |
JarOutputStream |
The JarOutputStream is used to write data in the JarFile
format to an arbitrary output stream
|
ZipOutputStream |
Used to write (compress) data into zip files. |
|
Class Overview
Wraps an existing OutputStream
and performs some transformation on
the output data while it is being written. Transformations can be anything
from a simple byte-wise filtering output data to an on-the-fly compression or
decompression of the underlying stream. Output streams that wrap another
output stream and provide some additional functionality on top of it usually
inherit from this class.
Summary
Fields |
protected
OutputStream |
out |
The target output stream for this filter stream. |
Public Methods |
void
|
close()
Closes this stream.
|
void
|
flush()
Ensures that all pending data is sent out to the target stream.
|
void
|
write(byte[] buffer, int offset, int length)
Writes count bytes from the byte array buffer starting at
offset to the target stream.
|
void
|
write(int oneByte)
Writes one byte to the target stream.
|
[Expand]
Inherited Methods |
From class
java.io.OutputStream
void
|
close()
Closes this stream.
|
void
|
flush()
Flushes this stream.
|
void
|
write(byte[] buffer, int offset, int count)
Writes count bytes from the byte array buffer starting at
position offset to this stream.
|
void
|
write(byte[] buffer)
Equivalent to write(buffer, 0, buffer.length) .
|
abstract
void
|
write(int oneByte)
Writes a single byte to this stream.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
From interface
java.io.Flushable
abstract
void
|
flush()
Flushes the object by writing out any buffered data to the underlying
output.
|
|
From interface
java.lang.AutoCloseable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
Fields
The target output stream for this filter stream.
Public Constructors
public
FilterOutputStream
(OutputStream out)
Constructs a new FilterOutputStream
with out
as its
target stream.
Parameters
out
| the target stream that this stream writes to.
|
Public Methods
public
void
close
()
Closes this stream. This implementation closes the target stream.
Throws
IOException
| if an error occurs attempting to close this stream.
|
public
void
flush
()
Ensures that all pending data is sent out to the target stream. This
implementation flushes the target stream.
Throws
IOException
| if an error occurs attempting to flush this stream.
|
public
void
write
(byte[] buffer, int offset, int length)
Writes count
bytes from the byte array buffer
starting at
offset
to the target stream.
Parameters
buffer
| the buffer to write. |
offset
| the index of the first byte in buffer to write. |
length
| the number of bytes in buffer to write. |
public
void
write
(int oneByte)
Writes one byte to the target stream. Only the low order byte of the
integer oneByte
is written.
Parameters
oneByte
| the byte to be written. |
Throws
IOException
| if an I/O error occurs while writing to this stream.
|