Spring Integration

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

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

public class ByteArraySingleTerminatorSerializer
extends AbstractByteArraySerializer

Reads data in an InputStream to a byte[]; data must be terminated by a single byte (not included in resulting byte[]). Writes a byte[] to an OutputStream and adds the terminator.

Since:
2.2
Author:
Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
logger, maxMessageSize
 
Constructor Summary
ByteArraySingleTerminatorSerializer(byte delimiter)
           
 
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 the terminator.
 
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

ByteArraySingleTerminatorSerializer

public ByteArraySingleTerminatorSerializer(byte delimiter)
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 a single byte. Throws a SoftEndOfStreamException if the stream is closed immediately after the terminator (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 the terminator.

Throws:
java.io.IOException

Spring Integration