public class ProtobufMessageEncoder<OUT extends com.google.protobuf.GeneratedMessage> extends ByteBufferEncoder<OUT>
| Constructor and Description |
|---|
ProtobufMessageEncoder() |
| Modifier and Type | Method and Description |
|---|---|
int |
getEncodedSize(OUT message)
Computes the size of the serialized form of a message in bytes.
|
static <T extends com.google.protobuf.GeneratedMessage> |
newInstance(Class<T> clazz) |
void |
writeTo(OUT message,
ByteBuffer buffer)
Writes a message on a
ByteBuffer. |
createEncoderState, encode, encodepublic static <T extends com.google.protobuf.GeneratedMessage> ProtobufMessageEncoder<T> newInstance(Class<T> clazz)
public int getEncodedSize(OUT message)
ByteBufferEncodergetEncodedSize in class ByteBufferEncoder<OUT extends com.google.protobuf.GeneratedMessage>message - a message to be encodedpublic void writeTo(OUT message, ByteBuffer buffer)
ByteBufferEncoderByteBuffer.
n.b. The buffer is expected to have at least a sufficient capacity to handle the serialized form of the message.
writeTo in class ByteBufferEncoder<OUT extends com.google.protobuf.GeneratedMessage>message - a message to be encodedbuffer - a target ByteBufferCopyright © 2009–2013 Apache MINA Project. All rights reserved.