Class ByteArrayCrLfSerializer

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.core.serializer.Deserializer<byte[]>, org.springframework.core.serializer.Serializer<byte[]>

public class ByteArrayCrLfSerializer
extends AbstractPooledBufferByteArraySerializer
Reads data in an InputStream to a byte[]; data must be terminated by \r\n (not included in resulting byte[]). Writes a byte[] to an OutputStream and adds \r\n.
Since:
2.0
  • Field Details

  • Constructor Details

  • Method Details

    • doDeserialize

      public byte[] doDeserialize​(java.io.InputStream inputStream, byte[] buffer) throws java.io.IOException
      Reads the data in the inputStream to a byte[]. Data must be terminated by CRLF (\r\n). Throws a SoftEndOfStreamException if the stream is closed immediately after the \r\n (i.e. no data is in the process of being read).
      Specified by:
      doDeserialize in class AbstractPooledBufferByteArraySerializer
      Parameters:
      inputStream - the input stream.
      buffer - the raw working buffer (maxMessageSize).
      Returns:
      the decoded bytes.
      Throws:
      java.io.IOException - an io exception.
    • fillToCrLf

      public int fillToCrLf​(java.io.InputStream inputStream, byte[] buffer) throws java.io.IOException
      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 \r\n.
      Throws:
      java.io.IOException