|
|||||||||
| 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.TNonblockingTransport
org.apache.thrift.transport.TNonblockingSocket
public class TNonblockingSocket
Socket implementation of the TTransport interface. To be commented soon!
| Constructor Summary | |
|---|---|
TNonblockingSocket(java.nio.channels.SocketChannel socketChannel)
Constructor that takes an already created socket. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the socket. |
void |
flush()
Flushes the underlying output stream if not null. |
java.net.Socket |
getSocket()
Returns a reference to the underlying socket. |
boolean |
isOpen()
Checks whether the socket is connected. |
void |
open()
Connects the socket, creating a new socket object if necessary. |
int |
read(byte[] buf,
int off,
int len)
Reads from the underlying input stream if not null. |
int |
read(java.nio.ByteBuffer buffer)
Perform a nonblocking read into buffer. |
java.nio.channels.SelectionKey |
registerSelector(java.nio.channels.Selector selector,
int interests)
Register this socket with the specified selector for both read and write operations. |
void |
setTimeout(int timeout)
Sets the socket timeout |
void |
write(byte[] buf,
int off,
int len)
Writes to the underlying output stream if not null. |
int |
write(java.nio.ByteBuffer buffer)
Perform a nonblocking write of the data in buffer; |
| 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 |
| Constructor Detail |
|---|
public TNonblockingSocket(java.nio.channels.SocketChannel socketChannel)
throws TTransportException
socketChannel - Already created SocketChannel object
TTransportException - if there is an error setting up the streams| Method Detail |
|---|
public java.nio.channels.SelectionKey registerSelector(java.nio.channels.Selector selector,
int interests)
throws java.io.IOException
registerSelector in class TNonblockingTransportselector -
java.io.IOExceptionpublic void setTimeout(int timeout)
timeout - Milliseconds timeoutpublic java.net.Socket getSocket()
public boolean isOpen()
isOpen in class TTransport
public void open()
throws TTransportException
open in class TTransportTTransportException - if the transport could not be opened
public int read(java.nio.ByteBuffer buffer)
throws java.io.IOException
read in class TNonblockingTransportjava.io.IOException
public 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 read
TTransportException - if there was an error reading data
public int write(java.nio.ByteBuffer buffer)
throws java.io.IOException
write in class TNonblockingTransportjava.io.IOException
public 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 write
TTransportException - if there was an error writing data
public void flush()
throws TTransportException
flush in class TTransportTTransportException - if there was an error writing out data.public void close()
close in class TTransport
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||