public final class AutoExpandingBufferWriteTransport extends TEndpointTransport
knownMessageSize, remainingMessageSize| Constructor and Description |
|---|
AutoExpandingBufferWriteTransport(TConfiguration config,
int initialCapacity,
int frontReserve)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the transport.
|
AutoExpandingBuffer |
getBuf() |
int |
getLength() |
boolean |
isOpen()
Queries whether the transport is open.
|
void |
open()
Opens the transport for reading/writing.
|
int |
read(byte[] buf,
int off,
int len)
Reads up to len bytes into buffer buf, starting at offset off.
|
void |
reset() |
void |
write(byte[] toWrite,
int off,
int len)
Writes up to len bytes from the buffer.
|
checkReadBytesAvailable, countConsumedMessageBytes, getConfiguration, getMaxMessageSize, resetConsumedMessageSize, updateKnownMessageSizeconsumeBuffer, flush, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, read, readAll, write, writepublic AutoExpandingBufferWriteTransport(TConfiguration config, int initialCapacity, int frontReserve) throws TTransportException
config - the configuration to use. Currently used for defining the maximum message size.initialCapacity - the initial capacity of the bufferfrontReserve - space, if any, to reserve at the beginning such
that the first write is after this reserve.
This allows framed transport to reserve space
for the frame buffer length.java.lang.IllegalArgumentException - if initialCapacity is less than onejava.lang.IllegalArgumentException - if frontReserve is less than zerojava.lang.IllegalArgumentException - if frontReserve is greater than initialCapacityTTransportExceptionpublic void close()
TTransportclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class TTransportpublic boolean isOpen()
TTransportisOpen in class TTransportpublic void open()
throws TTransportException
TTransportopen in class TTransportTTransportException - if the transport could not be openedpublic int read(byte[] buf,
int off,
int len)
throws TTransportException
TTransportread in class TTransportbuf - Array to read intooff - Index to start reading atlen - Maximum number of bytes to readTTransportException - if there was an error reading datapublic void write(byte[] toWrite,
int off,
int len)
throws TTransportException
TTransportwrite in class TTransporttoWrite - The output data bufferoff - The offset to start writing fromlen - The number of bytes to writeTTransportException - if there was an error writing datapublic AutoExpandingBuffer getBuf()
public int getLength()
public void reset()