public class IdentityMessageBodyOutputStream extends OutputStream
OutputStream
and all of the operations on
IdentityMessageBodyOutputStream
are delegated to this underlying OutputStream
.Constructor and Description |
---|
IdentityMessageBodyOutputStream(OutputStream os)
Creates a new instance of
IdentityMessageBodyOutputStream using the OutputStream as the
underlying OutputStream to write the data to. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this output stream and flushes the underlying
OutputStream . |
void |
flush()
Flushes the underlying output stream.
|
void |
write(byte[] b)
Writes the content of the byte array to the underlying output stream.
|
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array starting at offset off to this output
stream. |
void |
write(int b)
Writes the specified byte to this output stream.
|
public IdentityMessageBodyOutputStream(OutputStream os)
IdentityMessageBodyOutputStream
using the OutputStream
as the
underlying OutputStream to write the data to.os
- the underlying OutputStream
to usepublic final void close() throws IOException
OutputStream
. This method DOES NOT close the
underlying stream (i.e. the TCP connection stream). It is the responsibility of the caller to close the
underlying stream.close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
- when an I/O error occurs while closing the streampublic final void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
- if this output stream has already been closed.public final void write(byte[] b) throws IOException
write
in class OutputStream
b
- the byte array to read bytes from and write to the underlying output stream.IOException
- if this output stream has already been closed.OutputStream.write(byte[], int, int)
public final void write(byte[] b, int off, int len) throws IOException
len
bytes from the specified byte array starting at offset off
to this output
stream. The general contract for write(b, off, len) is that some of the bytes in the array b
are
written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte
written by this operation. If b
is null, a NullPointerException
is thrown. If
off
is negative, or len
is negative, or off
+len
is greater
than the length of the array b
, then an IndexOutOfBoundsException
is thrown.write
in class OutputStream
b
- the byte array to read bytes fromoff
- the starting index in byte array b
to read bytes fromlen
- number of bytes to read from the byte array b
IOException
- if this output stream has already been closedpublic final void write(int b) throws IOException
b
. The 24
high-order bits of b are ignored.write
in class OutputStream
b
- the value to be written to the underlying output streamIOException
- if this output stream has already been closed