TSocket
public class TIOStreamTransport extends TTransport
Modifier and Type | Field | Description |
---|---|---|
protected java.io.InputStream |
inputStream_ |
Underlying inputStream
|
protected java.io.OutputStream |
outputStream_ |
Underlying outputStream
|
Modifier | Constructor | 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 | 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
consumeBuffer, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, write
protected 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 TTransport
public void open() throws TTransportException
open
in class TTransport
TTransportException
- if the transport could not be openedpublic void close()
close
in class TTransport
public int read(byte[] buf, int off, int len) throws TTransportException
read
in class TTransport
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, int off, int len) throws TTransportException
write
in class TTransport
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
flush
in class TTransport
TTransportException
- if there was an error writing out data.