public class TMemoryBuffer extends TEndpointTransport
knownMessageSize, remainingMessageSize| Constructor and Description |
|---|
TMemoryBuffer(int size)
Create a TMemoryBuffer with an initial buffer size of size.
|
TMemoryBuffer(TConfiguration config,
int size)
Create a TMemoryBuffer with an initial buffer size of size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the transport.
|
byte[] |
getArray() |
java.lang.String |
inspect() |
boolean |
isOpen()
Queries whether the transport is open.
|
int |
length() |
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.
|
java.lang.String |
toString(java.nio.charset.Charset charset)
Output the contents of the memory buffer as a String, using the supplied
encoding
|
void |
write(byte[] buf,
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 TMemoryBuffer(int size)
throws TTransportException
size - the initial size of the bufferTTransportException - on error initializing the underlying transport.public TMemoryBuffer(TConfiguration config, int size) throws TTransportException
config - the configuration to use.size - the initial size of the bufferTTransportException - on error initializing the underlying transport.public boolean isOpen()
TTransportisOpen in class TTransportpublic void open()
TTransportopen in class TTransportpublic void close()
TTransportclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class TTransportpublic 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[] buf,
int off,
int len)
TTransportwrite in class TTransportbuf - The output data bufferoff - The offset to start writing fromlen - The number of bytes to writepublic java.lang.String toString(java.nio.charset.Charset charset)
charset - the encoding to usepublic java.lang.String inspect()
public int length()
public byte[] getArray()