public class ByteArrayRawSerializer extends AbstractPooledBufferByteArraySerializer
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.
Modifier and Type | Field and Description |
---|---|
static ByteArrayRawSerializer |
INSTANCE
A single reusable instance that does not treat timeouts as end of message.
|
DEFAULT_MAX_MESSAGE_SIZE, logger
Constructor and Description |
---|
ByteArrayRawSerializer() |
ByteArrayRawSerializer(boolean treatTimeoutAsEndOfMessage)
Treat socket timeouts as a normal EOF and emit the (possibly partial)
message.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
doDeserialize(InputStream inputStream,
byte[] buffer) |
void |
serialize(byte[] bytes,
OutputStream outputStream) |
copyToSizedArray, deserialize, setPoolSize, setPoolWaitTimeout
checkClosure, getMaxMessageSize, publishEvent, setApplicationEventPublisher, setMaxMessageSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
serializeToByteArray
deserializeFromByteArray
public static final ByteArrayRawSerializer INSTANCE
public ByteArrayRawSerializer()
public ByteArrayRawSerializer(boolean treatTimeoutAsEndOfMessage)
treatTimeoutAsEndOfMessage
- true to emit a message after a timeout.public void serialize(byte[] bytes, OutputStream outputStream) throws IOException
IOException
protected byte[] doDeserialize(InputStream inputStream, byte[] buffer) throws IOException
doDeserialize
in class AbstractPooledBufferByteArraySerializer
inputStream
- the input stream.buffer
- the raw working buffer (maxMessageSize).IOException
- an io exception.