Package marauroa.common.net
Class MessageFactory
java.lang.Object
marauroa.common.net.MessageFactory
MessageFactory is the class that is in charge of building the messages from
the stream of bytes.
MessageFactory follows the singleton pattern.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MessageFactory
This method returns an instance of MessageFactorygetMessage(byte[] data)
Returns a object of the right class from a stream of serialized data.getMessage(byte[] data, int offset)
Returns a object of the right class from a stream of serialized data.getMessage(Map<String,Object> in)
Returns a object of the right class from a stream of serialized data.
-
Method Details
-
getFactory
This method returns an instance of MessageFactory- Returns:
- A shared instance of MessageFactory
-
getMessage
Returns a object of the right class from a stream of serialized data.- Parameters:
data
- the serialized data- Returns:
- a message of the right class
- Throws:
IOException
- in case of problems with the messageInvalidVersionException
- if the message version doesn't match
-
getMessage
Returns a object of the right class from a stream of serialized data.- Parameters:
data
- the serialized dataoffset
- where to start reading in the data-array.- Returns:
- a message of the right class
- Throws:
IOException
- in case of problems with the messageInvalidVersionException
- if the message version doesn't match
-
getMessage
Returns a object of the right class from a stream of serialized data.- Parameters:
in
- the serialized data- Returns:
- a message of the right class
- Throws:
IOException
- in case of problems with the message
-