|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.epam.common.transport.NIOSocketTransport
public abstract class NIOSocketTransport
Abstract socket implementation of transport.
| Field Summary | |
|---|---|
static String |
BLOCKING_SOCKETS_FLAG
|
protected InputStream |
is
|
protected boolean |
isBlocking
|
protected OutputStream |
os
|
protected SelectionKey |
readSelectionKey
|
protected Selector |
readSelector
|
protected Socket |
socket
|
static int |
SOCKET_READ_SIZE
|
protected SocketChannel |
socketChannel
|
static String |
SPINNING_READ_FLAG
|
protected boolean |
useSpinningReadSelect
|
protected SelectionKey |
writeSelectionKey
|
protected Selector |
writeSelector
|
| Constructor Summary | |
|---|---|
NIOSocketTransport()
|
|
| Method Summary | |
|---|---|
void |
close()
Close the transport. |
String |
getAddress()
Getter for address value. |
int |
getPort()
Getter for port value. |
boolean |
isBlockingSocket()
|
boolean |
isOpen()
Returns true if, transport is open. |
abstract void |
open()
Open the transport. |
int |
read(byte[] buffer)
Transport dependent read method. |
int |
read(byte[] buffer,
int offset,
int length)
Transport dependent read method. |
int |
read(ByteBuffer buffer)
|
int |
read(ByteBuffer buffer,
int offset,
int length)
|
void |
setSessionConnectivityParams(HashMap<String,Object> connectivityParams)
|
void |
waitUntilReadyToWrite()
|
void |
write(byte[] message)
Transport dependent write method. |
int |
write(byte[] buffer,
int offset,
int length)
Transport dependent write method. |
int |
write(ByteBuffer buffer)
|
int |
write(ByteBuffer buffer,
int offset,
int length)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SOCKET_READ_SIZE
public static final String BLOCKING_SOCKETS_FLAG
public static final String SPINNING_READ_FLAG
protected Socket socket
protected InputStream is
protected OutputStream os
protected Selector readSelector
protected Selector writeSelector
protected SocketChannel socketChannel
protected SelectionKey readSelectionKey
protected SelectionKey writeSelectionKey
protected boolean isBlocking
protected boolean useSpinningReadSelect
| Constructor Detail |
|---|
public NIOSocketTransport()
| Method Detail |
|---|
public void setSessionConnectivityParams(HashMap<String,Object> connectivityParams)
public boolean isBlockingSocket()
isBlockingSocket in interface Transport
public int write(ByteBuffer buffer)
throws IOException
write in interface TransportIOException
public void waitUntilReadyToWrite()
throws IOException
waitUntilReadyToWrite in interface TransportIOException
public final int write(byte[] buffer,
int offset,
int length)
throws IOException
Transport
write in interface Transportbuffer - actual messageoffset - the offset in bufferlength - the num of bytes to write
IOException - if unable to write
public final int write(ByteBuffer buffer,
int offset,
int length)
throws IOException
write in interface TransportIOException
public final int read(ByteBuffer buffer,
int offset,
int length)
throws IOException
read in interface TransportIOException
public final int read(ByteBuffer buffer)
throws IOException
read in interface TransportIOException
public int read(byte[] buffer,
int offset,
int length)
throws IOException
Transport
read in interface Transportbuffer - holder for read bytesoffset - in bufferlength - maximum bytes to be read
IOException - if unable to readTransport.read(byte[], int, int)
public int read(byte[] buffer)
throws IOException
Transport
read in interface Transportbuffer - holder for read bytes
IOException - if unable to readTransport.read(byte[])
public void write(byte[] message)
throws IOException
Transport
write in interface Transportmessage - actual message
IOException - if unable to writeTransport.write(byte[])public String getAddress()
Transport
getAddress in interface TransportTransport.getAddress()public int getPort()
Transport
getPort in interface TransportTransport.getPort()
public void close()
throws IOException
Transport
close in interface TransportIOException - - throws if error occurredTransport.close()
public abstract void open()
throws IOException
Transport
open in interface TransportIOException - - throws if error occurredTransport.open()public boolean isOpen()
Transport
isOpen in interface TransportTransport.isOpen()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||