org.springframework.integration.ip.tcp.serializer
Class ByteArrayStxEtxSerializer

java.lang.Object
  extended by org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
      extended by org.springframework.integration.ip.tcp.serializer.ByteArrayStxEtxSerializer
All Implemented Interfaces:
Deserializer<byte[]>, Serializer<byte[]>

public class ByteArrayStxEtxSerializer
extends AbstractByteArraySerializer

Reads data in an InputStream to a byte[]; data must be prefixed by <stx> and terminated by <etx> (not included in resulting byte[]). Writes a byte[] to an OutputStream prefixed by <stx> terminated by <etx>

Since:
2.0

Field Summary
static int ETX
           
static int STX
           
 
Fields inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
logger, maxMessageSize
 
Constructor Summary
ByteArrayStxEtxSerializer()
           
 
Method Summary
 byte[] deserialize(java.io.InputStream inputStream)
          Reads the data in the inputstream to a byte[].
 void serialize(byte[] bytes, java.io.OutputStream outputStream)
          Writes the byte[] to the stream, prefixed by an ASCII STX character and terminated with an ASCII ETX character.
 
Methods inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
checkClosure, getMaxMessageSize, setMaxMessageSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STX

public static final int STX
See Also:
Constant Field Values

ETX

public static final int ETX
See Also:
Constant Field Values
Constructor Detail

ByteArrayStxEtxSerializer

public ByteArrayStxEtxSerializer()
Method Detail

deserialize

public byte[] deserialize(java.io.InputStream inputStream)
                   throws java.io.IOException
Reads the data in the inputstream to a byte[]. Data must be prefixed with an ASCII STX character, and terminated with an ASCII ETX character. Throws a SoftEndOfStreamException if the stream is closed immediately before the STX (i.e. no data is in the process of being read).

Throws:
java.io.IOException

serialize

public void serialize(byte[] bytes,
                      java.io.OutputStream outputStream)
               throws java.io.IOException
Writes the byte[] to the stream, prefixed by an ASCII STX character and terminated with an ASCII ETX character.

Throws:
java.io.IOException