public class TransportWriter extends Object implements ByteWriter
TransportWriter object is used to write bytes to
and underlying transport. This is essentially an adapter between
an OutputStream and the underlying transport. Each
byte array segment written to the underlying transport is wrapped
in a bytes buffer so that it can be sent by the transport layer.Transport| Constructor and Description |
|---|
TransportWriter(Transport transport)
Constructor for the
TransportWriter object. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This is used to close the writer and the underlying transport.
|
void |
flush()
This method is used to flush the contents of the buffer to
the client.
|
void |
write(byte[] array)
This method is used to deliver the provided array of bytes to
the underlying transport.
|
void |
write(byte[] array,
int off,
int len)
This method is used to deliver the provided array of bytes to
the underlying transport.
|
void |
write(ByteBuffer buffer)
This method is used to deliver the provided buffer of bytes to
the underlying transport.
|
void |
write(ByteBuffer buffer,
int off,
int len)
This method is used to deliver the provided buffer of bytes to
the underlying transport.
|
public TransportWriter(Transport transport)
TransportWriter object. This
is used to create an adapter for the transport such that a
byte array can be used to write bytes to the array.transport - the underlying transport to write bytes topublic void write(byte[] array)
throws IOException
write in interface ByteWriterarray - this is the array of bytes to write to the clientIOExceptionpublic void write(byte[] array,
int off,
int len)
throws IOException
write in interface ByteWriterarray - this is the array of bytes to write to the clientoff - this is the offset within the array to write fromlen - this is the number of bytes that are to be sentIOExceptionpublic void write(ByteBuffer buffer) throws IOException
write in interface ByteWriterbuffer - this is the buffer of bytes to write to the clientIOExceptionpublic void write(ByteBuffer buffer, int off, int len) throws IOException
write in interface ByteWriterbuffer - this is the buffer of bytes to write to the clientoff - this is the offset within the buffer to write fromlen - this is the number of bytes that are to be sentIOExceptionpublic void flush()
throws IOException
flush in interface ByteWriterIOExceptionpublic void close()
throws IOException
close in interface ByteWriterIOExceptionCopyright © 2024. All rights reserved.