public class IdentityMessageBodyOutputStream
extends java.io.OutputStream
OutputStream
and all of the operations on
IdentityMessageBodyOutputStream
are delegated to this underlying OutputStream
.Constructor and Description |
---|
IdentityMessageBodyOutputStream(java.io.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(java.io.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 java.io.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 java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
- when an I/O error occurs while closing the streampublic final void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
- if this output stream has already been closed.public final void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte array to read bytes from and write to the underlying output stream.java.io.IOException
- if this output stream has already been closed.public final void write(byte[] b, int off, int len) throws java.io.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 java.io.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
java.io.IOException
- if this output stream has already been closedpublic final void write(int b) throws java.io.IOException
b
. The 24
high-order bits of b are ignored.write
in class java.io.OutputStream
b
- the value to be written to the underlying output streamjava.io.IOException
- if this output stream has already been closed