Spring Integration

org.springframework.integration.ip.tcp.converter
Class ByteArrayStxEtxConverter

java.lang.Object
  extended by org.springframework.integration.ip.tcp.converter.AbstractByteArrayStreamingConverter
      extended by org.springframework.integration.ip.tcp.converter.ByteArrayStxEtxConverter
All Implemented Interfaces:
InputStreamingConverter<byte[]>, 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
           
 
Fields inherited from class org.springframework.integration.ip.tcp.converter.AbstractByteArrayStreamingConverter
logger, maxMessageSize
 
Constructor Summary
ByteArrayStxEtxConverter()
           
 
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 org.springframework.integration.ip.tcp.converter.AbstractByteArrayStreamingConverter
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

ByteArrayStxEtxConverter

public ByteArrayStxEtxConverter()
Method Detail

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).

Parameters:
inputStream - The InputStream.
Returns:
The object.
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.

Parameters:
bytes - The object.
outputStream - The outputStream.
Throws:
IOException

Spring Integration

Copyright © 2010. All Rights Reserved.