Class ByteArrayRawSerializer

All Implemented Interfaces:
Aware, ApplicationEventPublisherAware, Deserializer<byte[]>, Serializer<byte[]>

public class ByteArrayRawSerializer extends AbstractPooledBufferByteArraySerializer
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 Details

    • INSTANCE

      public static final ByteArrayRawSerializer INSTANCE
      A single reusable instance that does not treat timeouts as end of message.
  • Constructor Details

    • ByteArrayRawSerializer

      public ByteArrayRawSerializer()
    • ByteArrayRawSerializer

      public 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