Class ByteArrayCrLfSerializer
java.lang.Object
org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
org.springframework.integration.ip.tcp.serializer.AbstractPooledBufferByteArraySerializer
org.springframework.integration.ip.tcp.serializer.ByteArrayCrLfSerializer
- All Implemented Interfaces:
- Aware,- ApplicationEventPublisherAware,- Deserializer<byte[]>,- Serializer<byte[]>
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
- Author:
- Gary Russell, Artem Bilan
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ByteArrayCrLfSerializerA single reusable instance.Fields inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializerDEFAULT_MAX_MESSAGE_SIZE, logger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbyte[]doDeserialize(InputStream inputStream, byte[] buffer) Reads the data in the inputStream to a byte[].intfillToCrLf(InputStream inputStream, byte[] buffer) voidserialize(byte[] bytes, OutputStream outputStream) Writes the byte[] to the stream and appends \r\n.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.
 
- 
- 
Constructor Details- 
ByteArrayCrLfSerializerpublic ByteArrayCrLfSerializer()
 
- 
- 
Method Details- 
doDeserializeReads the data in the inputStream to a byte[]. Data must be terminated by CRLF (\r\n). Throws aSoftEndOfStreamExceptionif the stream is closed immediately after the \r\n (i.e. no data is in the process of being read).- 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.
 
- 
fillToCrLf- Throws:
- IOException
 
- 
serializeWrites the byte[] to the stream and appends \r\n.- Throws:
- IOException
 
 
-