public class TMemoryBuffer extends TTransport
Constructor and Description |
---|
TMemoryBuffer(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.lang.String enc)
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.
|
consumeBuffer, flush, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, write
public TMemoryBuffer(int size)
public boolean isOpen()
TTransport
isOpen
in class TTransport
public void open()
TTransport
open
in class TTransport
public void close()
TTransport
close
in class TTransport
public int read(byte[] buf, int off, int len)
TTransport
read
in class TTransport
buf
- Array to read intooff
- Index to start reading atlen
- Maximum number of bytes to readpublic void write(byte[] buf, int off, int len)
TTransport
write
in class TTransport
buf
- The output data bufferoff
- The offset to start writing fromlen
- The number of bytes to writepublic java.lang.String toString(java.lang.String enc) throws java.io.UnsupportedEncodingException
enc
- the encoding to usejava.io.UnsupportedEncodingException
public java.lang.String inspect()
public int length()
public byte[] getArray()