Class AbstractPooledBufferByteArraySerializer
java.lang.Object
org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
org.springframework.integration.ip.tcp.serializer.AbstractPooledBufferByteArraySerializer
- All Implemented Interfaces:
- Aware,- ApplicationEventPublisherAware,- Deserializer<byte[]>,- Serializer<byte[]>
- Direct Known Subclasses:
- ByteArrayCrLfSerializer,- ByteArrayRawSerializer,- ByteArraySingleTerminatorSerializer,- ByteArrayStxEtxSerializer
Base class for deserializers that cannot determine the buffer size needed.
 Optionally pools buffers.
- Since:
- 4.3
- Author:
- Gary Russell
- 
Field SummaryFields inherited from class org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializerDEFAULT_MAX_MESSAGE_SIZE, logger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected byte[]copyToSizedArray(byte[] buffer, int size) Copy size bytes to a new buffer exactly size bytes long.final byte[]deserialize(InputStream inputStream) protected abstract byte[]doDeserialize(InputStream inputStream, byte[] buffer) voidsetPoolSize(int size) Set the pool size for deserialization buffers.voidsetPoolWaitTimeout(long poolWaitTimeout) Set the pool wait timeout if a pool is configured, default unlimited.Methods 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.Serializerserialize, serializeToByteArray
- 
Constructor Details- 
AbstractPooledBufferByteArraySerializerpublic AbstractPooledBufferByteArraySerializer()
 
- 
- 
Method Details- 
setPoolSizepublic void setPoolSize(int size) Set the pool size for deserialization buffers.- Parameters:
- size- the size, -1 for unlimited.
- Since:
- 4.3
 
- 
setPoolWaitTimeoutpublic void setPoolWaitTimeout(long poolWaitTimeout) Set the pool wait timeout if a pool is configured, default unlimited.- Parameters:
- poolWaitTimeout- the timeout.
 
- 
deserialize- Throws:
- IOException
 
- 
doDeserialize- Parameters:
- inputStream- the input stream.
- buffer- the raw working buffer (maxMessageSize).
- Returns:
- the decoded bytes.
- Throws:
- IOException- an io exception.
- Since:
- 4.3
 
- 
copyToSizedArrayprotected byte[] copyToSizedArray(byte[] buffer, int size) Copy size bytes to a new buffer exactly size bytes long. If a pool is not in use and the array is already the correct length, it is simply returned.- Parameters:
- buffer- The buffer containing the data.
- size- The number of bytes to copy.
- Returns:
- The new buffer, or the buffer parameter if it is already the correct size and there is no pool.
 
 
-