|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gumbo.net.msg.Message | +--gumbo.net.msg.ascii.AsciiMessage
Abstract subclass of Message containing all aspects of ASCII transport of a message. This class and its subclasses should only depend on the message data format, with only loose coupling to the message transport format, implemented via AsciiMessageIO subclasses.
Messages that will be written to a stream (using an AsciiMessageWriter) are constructed with a writer and an empty head. Messages that will be read are constructed by passing a head, initialized by a reader, to the message factory method createAsciiMessage(), or by simply calling readMessage().
Subclasses must implement message-specific abstract methods (e.g. getType()), and should provide message-specific accessors for the message body (parameters and data unit contents).
See the Destiny client-server message protocol documentation for details concerning the message types and their parameters and data.
Constructor Summary | |
AsciiMessage()
Constructs an empty message with a head matching the type and body version of this message. |
|
AsciiMessage(AsciiMessageHead head)
Constructs a message with the specified head and an empty body. |
Method Summary | |
protected static AsciiMessage |
createAsciiMessage(AsciiMessageHead head)
Creates a new message of a specific type as indicated by a message head. |
protected void |
defaultHead()
Creates and sets the default head for this message. |
abstract void |
readAsciiBody()
Reads the body of this message from an ASCII message reader. |
static AsciiMessage |
readAsciiMessage(AsciiMessageReader reader)
Convenience method for reading a message in its entirety. |
abstract void |
writeAsciiBody()
Writes the body of this message to an ASCII message writer. |
void |
writeAsciiMessage(AsciiMessageWriter writer)
Convenience method for writing this message in its entirety. |
Methods inherited from class gumbo.net.msg.Message |
beforeBodyWrite, getBodyVersion, getHead, getMessageType, setHead, toBodyString, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AsciiMessage()
public AsciiMessage(AsciiMessageHead head) throws MessageDataException
head
- Initialized message head. Never null.
MessageDataException
- Mismatch between head and body message
type or body version.Method Detail |
public abstract void readAsciiBody() throws java.io.IOException, MessageIOException
MessageIOException
- Reader not at message body, or message head
format was bad.
java.io.IOException
public abstract void writeAsciiBody() throws java.io.IOException, MessageIOException
MessageIOException
- Writer not at message body, or message head
format was bad.
java.io.IOException
protected static AsciiMessage createAsciiMessage(AsciiMessageHead head) throws MessageDataException
head
- Initialized message head. Never null.
MessageDataException
- Unknown message type (head may not be
initialized) or mismatch between head data and implicit
message type or body version.public static AsciiMessage readAsciiMessage(AsciiMessageReader reader) throws java.io.IOException, MessageIOException, MessageDataException
This method is not thread-safe. Use the method of the same name in AsciiMessageReader to avoid thread conflicts.
MessageDataException
- Unknown message type (head may not be
initialized) or mismatch between head data and implicit
message type or body version.
java.io.IOException
MessageIOException
public void writeAsciiMessage(AsciiMessageWriter writer) throws java.io.IOException, MessageIOException
This method is not thread-safe. Use the method of the same name in AsciiMessageWriter to avoid thread conflicts.
java.io.IOException
MessageIOException
protected void defaultHead()
defaultHead
in class Message
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |