org.springframework.integration.ip.tcp.serializer
Class AbstractByteArraySerializer
java.lang.Object
org.springframework.integration.ip.tcp.serializer.AbstractByteArraySerializer
- All Implemented Interfaces:
- org.springframework.core.serializer.Deserializer<byte[]>, org.springframework.core.serializer.Serializer<byte[]>
- Direct Known Subclasses:
- ByteArrayCrLfSerializer, ByteArrayLengthHeaderSerializer, ByteArrayRawSerializer, ByteArraySingleTerminatorSerializer, ByteArrayStxEtxSerializer
public abstract class AbstractByteArraySerializer
- extends java.lang.Object
- implements org.springframework.core.serializer.Serializer<byte[]>, org.springframework.core.serializer.Deserializer<byte[]>
Base class for (de)serializers that provide a mechanism to
reconstruct a byte array from an arbitrary stream.
- Since:
- 2.0
- Author:
- Gary Russell
Method Summary |
protected void |
checkClosure(int bite)
|
protected byte[] |
copyToSizedArray(byte[] buffer,
int size)
Copy size bytes to a new buffer exactly size bytes long. |
int |
getMaxMessageSize()
The maximum supported message size for this serializer. |
void |
setMaxMessageSize(int maxMessageSize)
The maximum supported message size for this serializer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.core.serializer.Serializer |
serialize |
Methods inherited from interface org.springframework.core.serializer.Deserializer |
deserialize |
maxMessageSize
protected int maxMessageSize
logger
protected final org.apache.commons.logging.Log logger
AbstractByteArraySerializer
public AbstractByteArraySerializer()
getMaxMessageSize
public int getMaxMessageSize()
- The maximum supported message size for this serializer.
Default 2048.
- Returns:
- The max message size.
setMaxMessageSize
public void setMaxMessageSize(int maxMessageSize)
- The maximum supported message size for this serializer.
Default 2048.
- Parameters:
maxMessageSize
- The max message size.
checkClosure
protected void checkClosure(int bite)
throws java.io.IOException
- Throws:
java.io.IOException
copyToSizedArray
protected byte[] copyToSizedArray(byte[] buffer,
int size)
- Copy size bytes to a new buffer exactly size bytes long.
- 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.