public class MindRpcSerializer extends Object implements Serializer<MindRpcMessageHolder>, 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(InputStream inputStream) |
protected byte[] |
readBytes(InputStream inputStream,
int length)
Helper method to read bytes from a stream.
|
protected int[] |
readHeader(InputStream inputStream)
Reads the first line as a protocol header and parses sizes of
underlying headers and content.
|
protected Map<String,String> |
readHeaders(InputStream inputStream,
int length)
Reads a message headers from inputstream with a given length.
|
void |
serialize(MindRpcMessageHolder object,
OutputStream outputStream) |
void |
setMaxMessageSize(int maxMessageSize)
Sets the max message size for transport.
|
public MindRpcMessageHolder deserialize(InputStream inputStream) throws IOException
deserialize in interface Deserializer<MindRpcMessageHolder>IOExceptionDeserializer.deserialize(java.io.InputStream)public void serialize(MindRpcMessageHolder object, OutputStream outputStream) throws IOException
serialize in interface Serializer<MindRpcMessageHolder>IOExceptionSerializer.serialize(java.lang.Object, java.io.OutputStream)public void setMaxMessageSize(int maxMessageSize)
maxMessageSize - the length of max messageprotected int[] readHeader(InputStream inputStream) throws IOException
inputStream - the input streamIOException - if read error occuredprotected Map<String,String> readHeaders(InputStream inputStream, int length) throws IOException
inputStream - the input streamlength - how much to read from a streamIOException - if error occuredprotected byte[] readBytes(InputStream inputStream, int length) throws IOException
inputStream - the input streamlength - how much to readIOException - if error occuredprotected void checkClosure(int bite)
throws IOException
IOException