|
|||||||||
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 java.nio.ByteBuffer |
buildBuffer
|
protected boolean |
building
|
protected java.nio.channels.SocketChannel |
channel
|
protected java.nio.ByteBuffer |
dataPart
|
protected java.nio.ByteBuffer |
lengthPart
|
protected org.apache.commons.logging.Log |
logger
|
protected java.nio.ByteBuffer |
rawBuffer
|
protected int |
receiveBufferSize
|
protected boolean |
usingDirectBuffers
|
Fields inherited from class org.springframework.integration.ip.tcp.AbstractSocketReader |
---|
assembledData, messageFormat |
Fields inherited from interface org.springframework.integration.ip.tcp.MessageFormats |
---|
ETX, FORMAT_CRLF, FORMAT_CUSTOM, FORMAT_LENGTH_HEADER, FORMAT_STX_ETX, STX |
Constructor Summary | |
---|---|
NioSocketReader(java.nio.channels.SocketChannel channel)
Constructs an NioSocketReader which reads from the SocketChannel. |
Method Summary | |
---|---|
protected java.nio.ByteBuffer |
allocate(int length)
Allocates a ByteBuffer of the requested length using normal or direct buffers, depending on the usingDirectBuffers field. |
protected boolean |
assembleDataCrLfFormat()
Assembles data in format MessageFormats.FORMAT_CRLF . |
protected boolean |
assembleDataCustomFormat()
Throws UnsupportedOperationException ; custom implementations can
subclass this class and provide an implementation. |
boolean |
assembleDataLengthFormat()
Assembles data in format MessageFormats.FORMAT_LENGTH_HEADER . |
protected boolean |
assembleDataStxEtxFormat()
Assembles data in format MessageFormats.FORMAT_STX_ETX . |
protected void |
doClose()
Called after an exception; close the transport. |
java.net.InetAddress |
getAddress()
Returns the InetAddress of the underlying socket. |
byte[] |
getAssembledData()
Retrieves the assembled tcp data or null if the data is not yet assembled. |
boolean |
isUsingDirectBuffers()
|
protected void |
readChannel(java.nio.ByteBuffer buffer)
Reads from the channel into the buffer. |
protected boolean |
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, 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 java.nio.channels.SocketChannel channel
protected boolean usingDirectBuffers
protected java.nio.ByteBuffer lengthPart
protected java.nio.ByteBuffer dataPart
protected java.nio.ByteBuffer rawBuffer
protected java.nio.ByteBuffer buildBuffer
protected int receiveBufferSize
protected boolean building
Constructor Detail |
---|
public NioSocketReader(java.nio.channels.SocketChannel channel)
channel
- The channel.Method Detail |
---|
public byte[] getAssembledData()
SocketReader
public boolean assembleDataLengthFormat() throws java.io.IOException
AbstractSocketReader
MessageFormats.FORMAT_LENGTH_HEADER
.
assembleDataLengthFormat
in class AbstractSocketReader
java.io.IOException
protected boolean assembleDataStxEtxFormat() throws java.io.IOException
AbstractSocketReader
MessageFormats.FORMAT_STX_ETX
.
assembleDataStxEtxFormat
in class AbstractSocketReader
java.io.IOException
protected boolean assembleDataCrLfFormat() throws java.io.IOException
AbstractSocketReader
MessageFormats.FORMAT_CRLF
.
assembleDataCrLfFormat
in class AbstractSocketReader
java.io.IOException
protected boolean assembleDataCustomFormat() throws java.io.IOException
UnsupportedOperationException
; custom implementations can
subclass this class and provide an implementation.
assembleDataCustomFormat
in class AbstractSocketReader
java.io.IOException
AbstractSocketReader.assembleDataCustomFormat().
protected void readChannel(java.nio.ByteBuffer buffer) throws java.io.IOException
buffer
-
java.io.IOException
protected boolean readChannelNonDeterministic() throws java.io.IOException
java.io.IOException
protected java.nio.ByteBuffer allocate(int length)
length
-
protected void doClose()
AbstractSocketReader
doClose
in class AbstractSocketReader
public java.net.InetAddress getAddress()
SocketReader
public boolean isUsingDirectBuffers()
public void setUsingDirectBuffers(boolean usingDirectBuffers)
usingDirectBuffers
- the usingDirectBuffers to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |