Class ByteArrayRawSerializer
java.lang.Object
org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
org.springframework.integration.ip.tcp.serializer.AbstractPooledBufferByteArraySerializer
org.springframework.integration.ip.tcp.serializer.ByteArrayRawSerializer
- All Implemented Interfaces:
- Aware,- ApplicationEventPublisherAware,- Deserializer<byte[]>,- Serializer<byte[]>
A byte array (de)serializer that does nothing with the payload; sends it raw.
 Message termination for assembly purposes is signaled by the client closing the
 connection. The serializer does not, itself, close the connection after
 writing the bytes.
 
Because the socket must be closed to indicate message end, this (de)serializer can only be used by uni-directional (non-collaborating) channel adapters, and not by gateways.
Prior to 4.2.2, when using NIO, a timeout caused whatever had been partially received to be emitted as a message.
 Now, a SocketTimeoutException is thrown. To revert to the previous
 behavior, set the treatTimeoutAsEndOfMessage constructor argument to true.
- Since:
- 2.0.3
- Author:
- Gary Russell, Artem Bilan
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ByteArrayRawSerializerA single reusable instance that does not treat timeouts as end of message.Fields inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializerDEFAULT_MAX_MESSAGE_SIZE, logger
- 
Constructor SummaryConstructorsConstructorDescriptionByteArrayRawSerializer(boolean treatTimeoutAsEndOfMessage) Treat socket timeouts as a normal EOF and emit the (possibly partial) message.
- 
Method SummaryModifier and TypeMethodDescriptionprotected byte[]doDeserialize(InputStream inputStream, byte[] buffer) voidserialize(byte[] bytes, OutputStream outputStream) Methods inherited from class org.springframework.integration.ip.tcp.serializer.AbstractPooledBufferByteArraySerializercopyToSizedArray, deserialize, setPoolSize, setPoolWaitTimeoutMethods inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializercheckClosure, getMaxMessageSize, publishEvent, setApplicationEventPublisher, setMaxMessageSizeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.serializer.DeserializerdeserializeFromByteArrayMethods inherited from interface org.springframework.core.serializer.SerializerserializeToByteArray
- 
Field Details- 
INSTANCEA single reusable instance that does not treat timeouts as end of message.
 
- 
- 
Constructor Details- 
ByteArrayRawSerializerpublic ByteArrayRawSerializer()
- 
ByteArrayRawSerializerpublic ByteArrayRawSerializer(boolean treatTimeoutAsEndOfMessage) Treat socket timeouts as a normal EOF and emit the (possibly partial) message.- Parameters:
- treatTimeoutAsEndOfMessage- true to emit a message after a timeout.
- Since:
- 4.2.2
 
 
- 
- 
Method Details- 
serialize- Throws:
- IOException
 
- 
doDeserialize- Specified by:
- doDeserializein class- AbstractPooledBufferByteArraySerializer
- Parameters:
- inputStream- the input stream.
- buffer- the raw working buffer (maxMessageSize).
- Returns:
- the decoded bytes.
- Throws:
- IOException- an io exception.
 
 
-