Spring Integration

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

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

public class ByteArrayCrLfSerializer
extends AbstractByteArraySerializer

Reads data in an InputStream to a byte[]; data must be 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.serializer.AbstractByteArraySerializer
logger, maxMessageSize
 
Constructor Summary
ByteArrayCrLfSerializer()
           
 
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 and appends \r\n.
 
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
 

Constructor Detail

ByteArrayCrLfSerializer

public ByteArrayCrLfSerializer()
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 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:
java.io.IOException

serialize

public void serialize(byte[] bytes,
                      java.io.OutputStream outputStream)
               throws java.io.IOException
Writes the byte[] to the stream and appends \r\n.

Throws:
java.io.IOException

Spring Integration