public class MindRpcSerializer extends java.lang.Object implements org.springframework.core.serializer.Serializer<MindRpcMessageHolder>, org.springframework.core.serializer.Deserializer<MindRpcMessageHolder>
Serializer
and Deserializer
interfaces
for mind protocol.Modifier and Type | Field and Description |
---|---|
protected int |
maxMessageSize |
Constructor and Description |
---|
MindRpcSerializer() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkClosure(int bite) |
MindRpcMessageHolder |
deserialize(java.io.InputStream inputStream) |
protected byte[] |
readBytes(java.io.InputStream inputStream,
int length)
Helper method to read bytes from a stream.
|
protected int[] |
readHeader(java.io.InputStream inputStream)
Reads the first line as a protocol header and parses sizes of
underlying headers and content.
|
protected java.util.Map<java.lang.String,java.lang.String> |
readHeaders(java.io.InputStream inputStream,
int length)
Reads a message headers from inputstream with a given length.
|
void |
serialize(MindRpcMessageHolder object,
java.io.OutputStream outputStream) |
void |
setMaxMessageSize(int maxMessageSize)
Sets the max message size for transport.
|
public MindRpcMessageHolder deserialize(java.io.InputStream inputStream) throws java.io.IOException
deserialize
in interface org.springframework.core.serializer.Deserializer<MindRpcMessageHolder>
java.io.IOException
Deserializer.deserialize(java.io.InputStream)
public void serialize(MindRpcMessageHolder object, java.io.OutputStream outputStream) throws java.io.IOException
serialize
in interface org.springframework.core.serializer.Serializer<MindRpcMessageHolder>
java.io.IOException
Serializer.serialize(java.lang.Object, java.io.OutputStream)
public void setMaxMessageSize(int maxMessageSize)
maxMessageSize
- the length of max messageprotected int[] readHeader(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- the input streamjava.io.IOException
- if read error occuredprotected java.util.Map<java.lang.String,java.lang.String> readHeaders(java.io.InputStream inputStream, int length) throws java.io.IOException
inputStream
- the input streamlength
- how much to read from a streamjava.io.IOException
- if error occuredprotected byte[] readBytes(java.io.InputStream inputStream, int length) throws java.io.IOException
inputStream
- the input streamlength
- how much to readjava.io.IOException
- if error occuredprotected void checkClosure(int bite) throws java.io.IOException
java.io.IOException