public abstract class TTransport
extends java.lang.Object
Constructor and Description |
---|
TTransport() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Closes the transport.
|
void |
consumeBuffer(int len)
Consume len bytes from the underlying buffer.
|
void |
flush()
Flush any pending data out of a transport buffer.
|
byte[] |
getBuffer()
Access the protocol's underlying buffer directly.
|
int |
getBufferPosition()
Return the index within the underlying buffer that specifies the next spot
that should be read from.
|
int |
getBytesRemainingInBuffer()
Get the number of bytes remaining in the underlying buffer.
|
abstract boolean |
isOpen()
Queries whether the transport is open.
|
abstract void |
open()
Opens the transport for reading/writing.
|
boolean |
peek()
Is there more data to be read?
|
abstract int |
read(byte[] buf,
int off,
int len)
Reads up to len bytes into buffer buf, starting at offset off.
|
int |
readAll(byte[] buf,
int off,
int len)
Guarantees that all of len bytes are actually read off the transport.
|
void |
write(byte[] buf)
Writes the buffer to the output
|
abstract void |
write(byte[] buf,
int off,
int len)
Writes up to len bytes from the buffer.
|
public abstract boolean isOpen()
public boolean peek()
public abstract void open() throws TTransportException
TTransportException
- if the transport could not be openedpublic abstract void close()
public abstract int read(byte[] buf, int off, int len) throws TTransportException
buf
- Array to read intooff
- Index to start reading atlen
- Maximum number of bytes to readTTransportException
- if there was an error reading datapublic int readAll(byte[] buf, int off, int len) throws TTransportException
buf
- 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) throws TTransportException
buf
- The output data bufferTTransportException
- if an error occurs writing datapublic abstract void write(byte[] buf, int off, int len) throws TTransportException
buf
- The output data bufferoff
- The offset to start writing fromlen
- The number of bytes to writeTTransportException
- if there was an error writing datapublic void flush() throws TTransportException
TTransportException
- if there was an error writing out data.public byte[] getBuffer()
public int getBufferPosition()
public int getBytesRemainingInBuffer()
public void consumeBuffer(int len)
len
-