|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MessageSerializer
Represents a serializer for an SMA message encoding type.
This interface represents an SMA message serializer. It is used by the SMA runtime to serialize messages that are not natively transportable by the provider through which the messages are being transported. There exists a unique serializer per message encoding type in the system.
Method Summary | |
---|---|
Object |
deserialize(ByteBuffer buffer,
Tracer tracer)
Deserialize (contruct) and SMA message from a serialized byte array. |
int |
getSerializedLength(Object message)
Get the length of a serialized message. |
void |
serialize(Object message,
com.neeve.io.IOBuffer buffer,
Tracer tracer)
Serialize an SMA message to a byte buffer. |
Method Detail |
---|
int getSerializedLength(Object message)
This method is invoked by the SMA runtime to estimate the length of a serialized
SMA message. The returned length is used to construct a byte buffer
for use with the serialize(java.lang.Object, com.neeve.io.IOBuffer, com.neeve.trace.Tracer)
method. This method is only used to estimate
an upper bound for the number of butes needs for buffer creation. The number of bytes
actually transported is equal by the number of bytes actually serialized by the
serialize(java.lang.Object, com.neeve.io.IOBuffer, com.neeve.trace.Tracer)
method. Therefore, the method implementation can return a
rough estimate as long as the estimate is assured to be higher than the actual
serialized size.
void serialize(Object message, com.neeve.io.IOBuffer buffer, Tracer tracer)
message
- The message to serialize.buffer
- The buffer into which to serialize the message.tracer
- Tracer used to output serialization related trace. Can be
null in which case no trace is output.This method is invoked by the SMA runtime to serialize an SMA message to a byte buffer. The method implementation should serialize the message to the buffer starting at the position marker. Upon return from this method, the position marker should be set to the end of the serialized message. Other markers should not be modified by the method.
Object deserialize(ByteBuffer buffer, Tracer tracer)
buffer
- The buffer from which to deserialize the message.tracer
- Tracer used to output deserialization related trace. Can be
null in which case no trace is output.This method is invoked by the SMA runtime to de-serialize an SMA message from a byte buffer. The method implementation should deserialize the message from the buffer starting at the position marker. Upon return from this method, the position marker should be set to the end of the serialized message. Other markers should not be modified by the method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |