|
Spring Integration | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.integration.ip.tcp.AbstractSocketReader
org.springframework.integration.ip.tcp.NioSocketReader
public class NioSocketReader
A non-blocking SocketReader that reads from a SocketChannel.
| Field Summary | |
|---|---|
protected ByteBuffer |
buildBuffer
|
protected boolean |
building
|
protected SocketChannel |
channel
|
protected ByteBuffer |
dataPart
|
protected ByteBuffer |
lengthPart
|
protected org.apache.commons.logging.Log |
logger
|
protected ByteBuffer |
rawBuffer
|
protected boolean |
usingDirectBuffers
|
| Fields inherited from class org.springframework.integration.ip.tcp.AbstractSocketReader |
|---|
assembledData, maxMessageSize, messageFormat |
| Fields inherited from interface org.springframework.integration.ip.tcp.SocketReader |
|---|
MESSAGE_COMPLETE, MESSAGE_INCOMPLETE, SOCKET_CLOSED |
| Fields inherited from interface org.springframework.integration.ip.tcp.MessageFormats |
|---|
ETX, FORMAT_CRLF, FORMAT_CUSTOM, FORMAT_IMPLICIT, FORMAT_JAVA_SERIALIZED, FORMAT_LENGTH_HEADER, FORMAT_STX_ETX, STX |
| Constructor Summary | |
|---|---|
NioSocketReader(SocketChannel channel)
Constructs an NioSocketReader which reads from the SocketChannel. |
|
| Method Summary | |
|---|---|
protected ByteBuffer |
allocate(int length)
Allocates a ByteBuffer of the requested length using normal or direct buffers, depending on the usingDirectBuffers field. |
protected int |
assembleDataCrLfFormat()
Assembles data in format MessageFormats.FORMAT_CRLF. |
protected int |
assembleDataCustomFormat()
Throws UnsupportedOperationException; custom implementations can
subclass this class and provide an implementation. |
int |
assembleDataLengthFormat()
Assembles data in format MessageFormats.FORMAT_LENGTH_HEADER. |
protected int |
assembleDataSerializedFormat()
Throws UnsupportedOperationException; Java serialization is currently only
supported using the NetSocketReader. |
protected int |
assembleDataStxEtxFormat()
Assembles data in format MessageFormats.FORMAT_STX_ETX. |
protected void |
doClose()
Called after an exception; close the transport. |
InetAddress |
getAddress()
Returns the InetAddress of the underlying socket. |
Socket |
getSocket()
|
boolean |
isUsingDirectBuffers()
|
protected int |
readChannel(ByteBuffer buffer)
Reads from the channel into the buffer. |
protected int |
readChannelNonDeterministic()
Reads data into the rawBuffer for non-deterministic algorithms. |
void |
setUsingDirectBuffers(boolean usingDirectBuffers)
|
| Methods inherited from class org.springframework.integration.ip.tcp.AbstractSocketReader |
|---|
assembleData, getAssembledData, setMaxMessageSize, setMessageFormat |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
protected SocketChannel channel
protected boolean usingDirectBuffers
protected ByteBuffer lengthPart
protected ByteBuffer dataPart
protected ByteBuffer rawBuffer
protected ByteBuffer buildBuffer
protected boolean building
| Constructor Detail |
|---|
public NioSocketReader(SocketChannel channel)
channel - The channel.| Method Detail |
|---|
public int assembleDataLengthFormat()
throws IOException
AbstractSocketReaderMessageFormats.FORMAT_LENGTH_HEADER.
assembleDataLengthFormat in class AbstractSocketReaderIOException
protected int assembleDataStxEtxFormat()
throws IOException
AbstractSocketReaderMessageFormats.FORMAT_STX_ETX.
assembleDataStxEtxFormat in class AbstractSocketReaderIOException
protected int assembleDataCrLfFormat()
throws IOException
AbstractSocketReaderMessageFormats.FORMAT_CRLF.
assembleDataCrLfFormat in class AbstractSocketReaderIOException
protected int assembleDataSerializedFormat()
throws IOException
UnsupportedOperationException; Java serialization is currently only
supported using the NetSocketReader.
assembleDataSerializedFormat in class AbstractSocketReaderIOExceptionAbstractSocketReader.assembleDataCustomFormat()
protected int assembleDataCustomFormat()
throws IOException
UnsupportedOperationException; custom implementations can
subclass this class and provide an implementation.
assembleDataCustomFormat in class AbstractSocketReaderIOExceptionAbstractSocketReader.assembleDataCustomFormat()
protected int readChannel(ByteBuffer buffer)
throws IOException
buffer -
IOException
protected int readChannelNonDeterministic()
throws IOException
IOExceptionprotected ByteBuffer allocate(int length)
protected void doClose()
AbstractSocketReader
doClose in class AbstractSocketReaderpublic InetAddress getAddress()
SocketReader
public boolean isUsingDirectBuffers()
public void setUsingDirectBuffers(boolean usingDirectBuffers)
usingDirectBuffers - the usingDirectBuffers to setpublic Socket getSocket()
|
Spring Integration | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||