public final class TByteBuffer extends TTransport
| Constructor and Description |
|---|
TByteBuffer(java.nio.ByteBuffer byteBuffer)
Creates a new TByteBuffer wrapping a given NIO ByteBuffer.
|
| Modifier and Type | Method and Description |
|---|---|
TByteBuffer |
clear()
Convenience method to call clear() on the underlying NIO ByteBuffer.
|
void |
close()
Closes the transport.
|
TByteBuffer |
flip()
Convenience method to call flip() on the underlying NIO ByteBuffer.
|
java.nio.ByteBuffer |
getByteBuffer()
Get the underlying NIO ByteBuffer.
|
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.
|
byte[] |
toByteArray()
Convenience method to convert the underlying NIO ByteBuffer to a
plain old byte array.
|
void |
write(byte[] buf,
int off,
int len)
Writes up to len bytes from the buffer.
|
consumeBuffer, flush, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, writepublic TByteBuffer(java.nio.ByteBuffer byteBuffer)
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)
throws TTransportException
TTransportwrite in class TTransportbuf - The output data bufferoff - The offset to start writing fromlen - The number of bytes to writeTTransportException - if there was an error writing datapublic java.nio.ByteBuffer getByteBuffer()
public TByteBuffer clear()
public TByteBuffer flip()
public byte[] toByteArray()