org.springframework.integration.ip.tcp.converter
Class ByteArrayStxEtxConverter
java.lang.Object
org.springframework.integration.ip.tcp.converter.AbstractByteArrayStreamingConverter
org.springframework.integration.ip.tcp.converter.ByteArrayStxEtxConverter
- All Implemented Interfaces:
- org.springframework.commons.serializer.InputStreamingConverter<byte[]>, org.springframework.commons.serializer.OutputStreamingConverter<byte[]>
public class ByteArrayStxEtxConverter
- extends AbstractByteArrayStreamingConverter
Converts data in an InputStream to a byte[]; data is prefixed by <stx> and
terminated by <etx> (not included in resulting byte[]).
Writes a byte[] to an OutputStream and prefixed by <stx> terminated by <etx>
- Since:
- 2.0
- Author:
- Gary Russell
Field Summary |
static int |
ETX
|
static int |
STX
|
Method Summary |
void |
convert(byte[] bytes,
OutputStream outputStream)
Writes the byte[] to the stream, prefixed by an ASCII STX character and
terminated with an ASCII ETX character. |
byte[] |
convert(InputStream inputStream)
Converts the data in the inputstream to a byte[]. |
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
ByteArrayStxEtxConverter
public ByteArrayStxEtxConverter()
convert
public byte[] convert(InputStream inputStream)
throws IOException
- Converts 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:
IOException
convert
public void convert(byte[] bytes,
OutputStream outputStream)
throws IOException
- Writes the byte[] to the stream, prefixed by an ASCII STX character and
terminated with an ASCII ETX character.
- Throws:
IOException
Copyright © 2010. All Rights Reserved.