org.springframework.integration.ip.tcp.serializer
Class ByteArrayStxEtxSerializer
java.lang.Object
org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STX
public static final int STX
- See Also:
- Constant Field Values
ETX
public static final int ETX
- See Also:
- Constant Field Values
ByteArrayStxEtxSerializer
public ByteArrayStxEtxSerializer()
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