Class ByteArraySingleTerminatorSerializer
java.lang.Object
org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
org.springframework.integration.ip.tcp.serializer.AbstractPooledBufferByteArraySerializer
org.springframework.integration.ip.tcp.serializer.ByteArraySingleTerminatorSerializer
- All Implemented Interfaces:
Aware,ApplicationEventPublisherAware,Deserializer<byte[]>,Serializer<byte[]>
- Direct Known Subclasses:
ByteArrayLfSerializer
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, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
DEFAULT_MAX_MESSAGE_SIZE, logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]doDeserialize(InputStream inputStream, byte[] buffer) Reads the data in the inputStream to a byte[].voidserialize(byte[] bytes, OutputStream outputStream) Writes the byte[] to the stream and appends the terminator.Methods inherited from class org.springframework.integration.ip.tcp.serializer.AbstractPooledBufferByteArraySerializer
copyToSizedArray, deserialize, setPoolSize, setPoolWaitTimeoutMethods inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
checkClosure, getMaxMessageSize, publishEvent, setApplicationEventPublisher, setMaxMessageSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.serializer.Deserializer
deserializeFromByteArrayMethods inherited from interface org.springframework.core.serializer.Serializer
serializeToByteArray
-
Constructor Details
-
ByteArraySingleTerminatorSerializer
public ByteArraySingleTerminatorSerializer(byte delimiter)
-
-
Method Details
-
doDeserialize
Reads the data in the inputStream to a byte[]. Data must be terminated by a single byte. Throws aSoftEndOfStreamExceptionif the stream is closed immediately after the terminator (i.e. no data is in the process of being read).- Specified by:
doDeserializein classAbstractPooledBufferByteArraySerializer- Parameters:
inputStream- the input stream.buffer- the raw working buffer (maxMessageSize).- Returns:
- the decoded bytes.
- Throws:
IOException- an io exception.
-
serialize
Writes the byte[] to the stream and appends the terminator.- Throws:
IOException
-