Package ej.hoka.io
Class IdentityMessageBodyOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- ej.hoka.io.IdentityMessageBodyOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class IdentityMessageBodyOutputStream extends java.io.OutputStreamIdentity output stream. Wraps anOutputStreamand all of the operations onIdentityMessageBodyOutputStreamare delegated to this underlyingOutputStream.
-
-
Constructor Summary
Constructors Constructor Description IdentityMessageBodyOutputStream(java.io.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(java.io.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 java.io.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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException- when an I/O error occurs while closing the stream
-
flush
public final void flush() throws java.io.IOExceptionFlushes the underlying output stream.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException- if this output stream has already been closed.
-
write
public final void write(byte[] b) throws java.io.IOExceptionWrites the content of the byte array to the underlying output stream.- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the byte array to read bytes from and write to the underlying output stream.- Throws:
java.io.IOException- if this output stream has already been closed.
-
write
public final void write(byte[] b, int off, int len) throws java.io.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 classjava.io.OutputStream- 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:
java.io.IOException- if this output stream has already been closed
-
write
public final void write(int b) throws java.io.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 classjava.io.OutputStream- Parameters:
b- the value to be written to the underlying output stream- Throws:
java.io.IOException- if this output stream has already been closed
-
-