Package ej.hoka.io
Class IdentityMessageBodyOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- ej.hoka.io.IdentityMessageBodyOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class IdentityMessageBodyOutputStream extends OutputStream
Identity output stream. Wraps anOutputStreamand all of the operations onIdentityMessageBodyOutputStreamare delegated to this underlyingOutputStream.
-
-
Constructor Summary
Constructors Constructor Description IdentityMessageBodyOutputStream(OutputStream os)Creates a new instance ofIdentityMessageBodyOutputStreamusing theOutputStreamas the underlying OutputStream to write the data to.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this output stream and flushes the underlyingOutputStream.voidflush()Flushes the underlying output stream.voidwrite(byte[] b)Writes the content of the byte array to the underlying output stream.voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto this output stream.voidwrite(int b)Writes the specified byte to this output stream.
-
-
-
Constructor Detail
-
IdentityMessageBodyOutputStream
public IdentityMessageBodyOutputStream(OutputStream os)
Creates a new instance ofIdentityMessageBodyOutputStreamusing theOutputStreamas the underlying OutputStream to write the data to.- Parameters:
os- the underlyingOutputStreamto use
-
-
Method Detail
-
close
public final void close() throws IOExceptionCloses this output stream and flushes the underlyingOutputStream. 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.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException- when an I/O error occurs while closing the stream
-
flush
public final void flush() throws IOExceptionFlushes the underlying output stream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- if this output stream has already been closed.
-
write
public final void write(byte[] b) throws IOExceptionWrites the content of the byte array to the underlying output stream.- Overrides:
writein classOutputStream- Parameters:
b- the byte array to read bytes from and write to the underlying output stream.- Throws:
IOException- if this output stream has already been closed.- See Also:
OutputStream.write(byte[], int, int)
-
write
public final void write(byte[] b, int off, int len) throws IOExceptionWriteslenbytes from the specified byte array starting at offsetoffto this output stream. The general contract for write(b, off, len) is that some of the bytes in the arraybare 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. Ifbis null, aNullPointerExceptionis thrown. Ifoffis negative, orlenis negative, oroff+lenis greater than the length of the arrayb, then anIndexOutOfBoundsExceptionis thrown.- Overrides:
writein classOutputStream- Parameters:
b- the byte array to read bytes fromoff- the starting index in byte arraybto read bytes fromlen- number of bytes to read from the byte arrayb- Throws:
IOException- if this output stream has already been closed
-
write
public final void write(int b) throws IOExceptionWrites the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argumentb. The 24 high-order bits of b are ignored.- Specified by:
writein classOutputStream- Parameters:
b- the value to be written to the underlying output stream- Throws:
IOException- if this output stream has already been closed
-
-