Spring Integration

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

java.lang.Object
  extended by org.springframework.integration.ip.tcp.converter.AbstractByteArrayStreamingConverter
      extended by org.springframework.integration.ip.tcp.converter.ByteArrayCrLfConverter
All Implemented Interfaces:
org.springframework.commons.serializer.InputStreamingConverter<byte[]>, org.springframework.commons.serializer.OutputStreamingConverter<byte[]>

public class ByteArrayCrLfConverter
extends AbstractByteArrayStreamingConverter

Converts data in an InputStream to a byte[]; data is terminated by \r\n (not included in resulting byte[]). Writes a byte[] to an OutputStream and adds \r\n.

Since:
2.0
Author:
Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.ip.tcp.converter.AbstractByteArrayStreamingConverter
logger, maxMessageSize
 
Constructor Summary
ByteArrayCrLfConverter()
           
 
Method Summary
 void convert(byte[] bytes, OutputStream outputStream)
          Writes the byte[] to the stream and appends \r\n.
 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
 

Constructor Detail

ByteArrayCrLfConverter

public ByteArrayCrLfConverter()
Method Detail

convert

public byte[] convert(InputStream inputStream)
               throws IOException
Converts the data in the inputstream to a byte[]. Data must be terminated by CRLF (\r\n). Throws a SoftEndOfStreamException if the stream is closed immediately after the \r\n (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 and appends \r\n.

Throws:
IOException

Spring Integration

Copyright © 2010. All Rights Reserved.