|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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
AbstractSocketReader
MessageFormats.FORMAT_LENGTH_HEADER
.
assembleDataLengthFormat
in class AbstractSocketReader
IOException
protected int assembleDataStxEtxFormat() throws IOException
AbstractSocketReader
MessageFormats.FORMAT_STX_ETX
.
assembleDataStxEtxFormat
in class AbstractSocketReader
IOException
protected int assembleDataCrLfFormat() throws IOException
AbstractSocketReader
MessageFormats.FORMAT_CRLF
.
assembleDataCrLfFormat
in class AbstractSocketReader
IOException
protected int assembleDataSerializedFormat() throws IOException
UnsupportedOperationException
; Java serialization is currently only
supported using the NetSocketReader.
assembleDataSerializedFormat
in class AbstractSocketReader
IOException
AbstractSocketReader.assembleDataCustomFormat()
protected int assembleDataCustomFormat() throws IOException
UnsupportedOperationException
; custom implementations can
subclass this class and provide an implementation.
assembleDataCustomFormat
in class AbstractSocketReader
IOException
AbstractSocketReader.assembleDataCustomFormat()
protected int readChannel(ByteBuffer buffer) throws IOException
buffer
-
IOException
protected int readChannelNonDeterministic() throws IOException
IOException
protected ByteBuffer allocate(int length)
protected void doClose()
AbstractSocketReader
doClose
in class AbstractSocketReader
public 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 |