public class TIOStreamTransport extends TTransport
| Modifier and Type | Field and Description |
|---|---|
protected java.io.InputStream |
inputStream_
Underlying inputStream
|
protected java.io.OutputStream |
outputStream_
Underlying outputStream
|
| Modifier | Constructor and Description |
|---|---|
protected |
TIOStreamTransport()
Subclasses can invoke the default constructor and then assign the input
streams in the open method.
|
|
TIOStreamTransport(java.io.InputStream is)
Input stream constructor.
|
|
TIOStreamTransport(java.io.InputStream is,
java.io.OutputStream os)
Two-way stream constructor.
|
|
TIOStreamTransport(java.io.OutputStream os)
Output stream constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes both the input and output streams.
|
void |
flush()
Flushes the underlying output stream if not null.
|
boolean |
isOpen()
The streams must already be open at construction time, so this should
always return true.
|
void |
open()
The streams must already be open.
|
int |
read(byte[] buf,
int off,
int len)
Reads from the underlying input stream if not null.
|
void |
write(byte[] buf,
int off,
int len)
Writes to the underlying output stream if not null.
|
consumeBuffer, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, writeprotected java.io.InputStream inputStream_
protected java.io.OutputStream outputStream_
protected TIOStreamTransport()
public TIOStreamTransport(java.io.InputStream is)
is - Input stream to read frompublic TIOStreamTransport(java.io.OutputStream os)
os - Output stream to read frompublic TIOStreamTransport(java.io.InputStream is,
java.io.OutputStream os)
is - Input stream to read fromos - Output stream to read frompublic boolean isOpen()
isOpen in class TTransportpublic void open()
throws TTransportException
open in class TTransportTTransportException - if the transport could not be openedpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class TTransportpublic int read(byte[] buf,
int off,
int len)
throws TTransportException
read 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
write 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 void flush()
throws TTransportException
flush in class TTransportTTransportException - if there was an error writing out data.