|
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.AbstractSocketWriter
public abstract class AbstractSocketWriter
Abstract SocketWriter that handles data in 3 standard, and one custom
format. The default format is MessageFormats.FORMAT_LENGTH_HEADER
in which
the message consists of a 4 byte integer (in network byte order) containing
the length of data that follows. MessageFormats.FORMAT_STX_ETX
indicates a message where the data begins with STX (0x02) and ends with
ETX (0x03); the STX and ETX are not part of the data. MessageFormats.FORMAT_CRLF
indicates a message followed by carriage return and line feed '\r\n'.
FORMAT_LENGTH_HEADER can be used for Socket
and
SocketChannel
implementations are provided for
the standard formats. Users requiring other formats should subclass the
appropriate implementation, and provide an implementation for
writeCustomFormat(Object)
which is invoked by write(Object)
when the format is MessageFormats.FORMAT_CUSTOM
.
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
protected int |
messageFormat
|
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 | |
---|---|
AbstractSocketWriter()
|
Method Summary | |
---|---|
protected abstract void |
doClose()
Called when an IO error |
void |
setMessageFormat(int messageFormat)
|
void |
write(Object object)
Write the entire buffer to the underlying socket. |
protected abstract void |
writeCrLfFormat(byte[] bytes)
Write the data, followed by carriage return, line feed ('\r\n'). |
protected abstract void |
writeCustomFormat(Object object)
Write the data using some custom protocol. |
protected abstract void |
writeLengthFormat(byte[] bytes)
Write the length of the data in a 4 byte integer (in network byte order) before the data itself. |
protected abstract void |
writeSerializedFormat(Object object)
Write the data, followed by carriage return, line feed ('\r\n'). |
protected abstract void |
writeStxEtxFormat(byte[] bytes)
Write an STX (0x02) followed by the data, followed by ETX (0x03). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int messageFormat
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public AbstractSocketWriter()
Method Detail |
---|
public void write(Object object) throws IOException
SocketWriter
write
in interface SocketWriter
object
- The object to write.
IOException
protected abstract void doClose()
protected abstract void writeLengthFormat(byte[] bytes) throws IOException
bytes
- The bytes to write.
IOException
protected abstract void writeStxEtxFormat(byte[] bytes) throws IOException
bytes
- The bytes to write.
IOException
protected abstract void writeCrLfFormat(byte[] bytes) throws IOException
IOException
protected abstract void writeSerializedFormat(Object object) throws IOException
IOException
protected abstract void writeCustomFormat(Object object) throws IOException
IOException
public void setMessageFormat(int messageFormat)
setMessageFormat
in interface SocketWriter
messageFormat
- the messageFormat to set
|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |