Rice Pastry API

rice.p2p.commonapi.rawserialization
Interface MessageDeserializer

All Known Implementing Classes:
ConsistentJoinProtocol.CJPDeserializer, GCPastImpl.GCPastDeserializer, JavaSerializedDeserializer, JavaSerializedDeserializer, PastImpl.PastDeserializer, PeriodicLeafSetProtocol.PLSPMessageDeserializer, PJavaSerializedDeserializer, StandardJoinProtocol.SJPDeserializer

public interface MessageDeserializer

Because Pastry/Transport layer cannot know about all messge types, each app needs to provide a deserializer. Default, there is a Java Serializer


Method Summary
 Message deserialize(InputBuffer buf, short type, int priority, NodeHandle sender)
          Typical implementation: RawMessage ret = super.deserialize(); if (ret != null) return ret; Endpoint endpoint; switch(type) { case 1: return new MyMessage(buf, endpoint); }
 

Method Detail

deserialize

Message deserialize(InputBuffer buf,
                    short type,
                    int priority,
                    NodeHandle sender)
                    throws java.io.IOException
Typical implementation: RawMessage ret = super.deserialize(); if (ret != null) return ret; Endpoint endpoint; switch(type) { case 1: return new MyMessage(buf, endpoint); }

Parameters:
buf - accessor to the bytes
type - the message type, defined in RawMessage.getType()
priority - the priority of the message
sender - the sender of the Message (may be null if not specified).
Returns:
The deserialized message.
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection