|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.thrift.transport.TTransport
org.apache.thrift.transport.TIOStreamTransport
public class TIOStreamTransport
This is the most commonly used base transport. It takes an InputStream and an OutputStream and uses those to perform all transport operations. This allows for compatibility with all the nice constructs Java already has to provide a variety of types of streams.
Field Summary | |
---|---|
protected java.io.InputStream |
inputStream_
Underlying inputStream |
protected java.io.OutputStream |
outputStream_
Underlying outputStream |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.apache.thrift.transport.TTransport |
---|
peek, readAll, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.InputStream inputStream_
protected java.io.OutputStream outputStream_
Constructor Detail |
---|
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 fromMethod Detail |
---|
public 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 read
TTransportException
- 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 write
TTransportException
- if there was an error writing datapublic void flush() throws TTransportException
flush
in class TTransport
TTransportException
- if there was an error writing out data.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |