net.sf.juoserver.protocol
Class DefaultMessageReader

java.lang.Object
  extended by net.sf.juoserver.protocol.DefaultMessageReader
All Implemented Interfaces:
MessageReader, MessageReaderFactory

public class DefaultMessageReader
extends Object
implements MessageReader, MessageReaderFactory

Default MessageReader implementation.


Constructor Summary
  DefaultMessageReader()
          Default constructor.
protected DefaultMessageReader(MessageDecoderProvider messageDecoderProvider, boolean seedSent)
          Builds a new DefaultMessageReader.
 
Method Summary
 MessageReader createMessageReader()
           
protected  MessageDecoderProvider getMessageDecoderProvider()
           
protected  Message nextMessage(byte[] contents)
           
 List<Message> readMessages(byte[] contents)
          Returns a list of Messages by parsing the provided byte array packet chunk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageReader

public DefaultMessageReader()
Default constructor.

Builds a new DefaultMessageReader that uses a ClasspathMessageDecoderProvider.

Throws:
BadDecodableException - in case a Decodable Message was misconfigured

DefaultMessageReader

protected DefaultMessageReader(MessageDecoderProvider messageDecoderProvider,
                               boolean seedSent)
Builds a new DefaultMessageReader.

Parameters:
messageDecoderProvider - MessageDecoderProvider to be used to identify Message types from their first byte
seedSent - when true, instructs the newly built reader to proceed as if the LoginSeed message has already been received
Method Detail

readMessages

public List<Message> readMessages(byte[] contents)
Description copied from interface: MessageReader
Returns a list of Messages by parsing the provided byte array packet chunk.

Specified by:
readMessages in interface MessageReader
Parameters:
contents - contents of the actual messages
Returns:
a list of Messages by parsing the provided byte array packet chunk
See Also:
UO Protocol (by POL)

nextMessage

protected Message nextMessage(byte[] contents)

getMessageDecoderProvider

protected MessageDecoderProvider getMessageDecoderProvider()

createMessageReader

public MessageReader createMessageReader()
Specified by:
createMessageReader in interface MessageReaderFactory


Copyright © 2010-2012. All Rights Reserved.