public class OutputStreamWrapper
extends java.io.OutputStream
OutputStream
wrapper for a
Stream
.Constructor and Description |
---|
OutputStreamWrapper(Stream out)
Creates an instance with the associated stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying stream and releases OS resources associated with it.
|
void |
write(byte[] b)
Writes the entire contents of the specified byte array to this output
stream.
|
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array starting
at offset off in this output stream. |
void |
write(int b)
Writes the specified byte to this output stream (only the low order 8
bits are written, the high order 24 bits are ignored).
|
private Stream out
public OutputStreamWrapper(Stream out)
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- The byte to write.java.io.IOException
- if an I/O error occurs. In particular, an IOException may be
thrown if the output stream has been closed.public void write(byte[] b) throws java.io.IOException, java.lang.NullPointerException
write
in class java.io.OutputStream
b
- The byte array to write.java.io.IOException
- if an I/O error occurs. In particular, an IOException may be
thrown if the output stream has been closed.java.lang.NullPointerException
- if the array is null
.public void write(byte[] b, int off, int len) throws java.io.IOException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
len
bytes from the specified byte array starting
at offset off
in this output stream. Element b[off] is
the first byte written and b[off+len-1] is the last byte written.write
in class java.io.OutputStream
b
- The array of bytes to write.off
- the start offset in the array.len
- the number of bytes to write.java.io.IOException
- if an I/O error occurs. In particular, an IOException may be
thrown if the output stream has been closed.java.lang.NullPointerException
- if the array is null
.java.lang.IndexOutOfBoundsException
- if the offset or length are negative, or if offset + length
is larger than the length of the array.public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream