| java.lang.Object | |
| ↳ | java.io.OutputStream |
Known Direct Subclasses
|
A writable sink for bytes.
Most clients will use output streams that write data to the file system
(FileOutputStream), the network (getOutputStream()/getOutputStream()), or to an in-memory byte array
(ByteArrayOutputStream).
Use OutputStreamWriter to adapt a byte stream like this one into a
character stream.
Most clients should wrap their output stream with BufferedOutputStream. Callers that do only bulk writes may omit buffering.
FilterOutputStream, which delegates all calls to the target output
stream.
All output stream subclasses should override both write(int) and write(byte[],int,int). The
three argument overload is necessary for bulk access to the data. This is
much more efficient than byte-by-byte access.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Closes this stream.
| |||||||||||
Flushes this stream.
| |||||||||||
Writes
count bytes from the byte array buffer starting at
position offset to this stream. | |||||||||||
Equivalent to
write(buffer, 0, buffer.length). | |||||||||||
Writes a single byte to this stream.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.io.Flushable
| |||||||||||
Closes this stream. Implementations of this method should free any resources used by the stream. This implementation does nothing.
| IOException | if an error occurs while closing this stream. |
|---|
Flushes this stream. Implementations of this method should ensure that any buffered data is written out. This implementation does nothing.
| IOException | if an error occurs while flushing this stream. |
|---|
Writes count bytes from the byte array buffer starting at
position offset to this stream.
| buffer | the buffer to be written. |
|---|---|
| offset | the start position in buffer from where to get bytes. |
| count | the number of bytes from buffer to write to this
stream. |
| IOException | if an error occurs while writing to this stream. |
|---|---|
| IndexOutOfBoundsException | if offset < 0 or count < 0, or if
offset + count is bigger than the length of
buffer.
|
Equivalent to write(buffer, 0, buffer.length).
| IOException |
|---|
Writes a single byte to this stream. Only the least significant byte of
the integer oneByte is written to the stream.
| oneByte | the byte to be written. |
|---|
| IOException | if an error occurs while writing to this stream. |
|---|