Package marauroa.common.net
Class Decoder
java.lang.Object
marauroa.common.net.Decoder
This class decodes a stream of bytes and builds a Marauroa message with it.
Decoder follows singleton pattern.
- Author:
- miguel, hendrik
-
Method Summary
-
Method Details
-
get
Returns an unique instance of decoder- Returns:
- an unique instance of decoder
-
clear
Removes any pending data from a connection- Parameters:
channel
- the channel to clear data from.
-
decode
public List<Message> decode(Object channel, byte[] data) throws IOException, InvalidVersionExceptionDecodes a message from a stream of bytes received from channel- Parameters:
channel
- the socket from where data was receiveddata
- the data received- Returns:
- a message or null if it was not possible
- Throws:
IOException
- if there is a problem building the messageInvalidVersionException
- if the message version mismatch the expected version
-