|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gumbo.net.msg.AbstractMessageIO | +--gumbo.net.msg.ascii.AsciiMessageIO | +--gumbo.net.msg.ascii.AsciiMessageWriter
Writes ASCII message elements (units, tokens, delimiters) to a writer or socket.
Field Summary |
Fields inherited from class gumbo.net.msg.ascii.AsciiMessageIO |
CHAR_MSG_END, CHAR_UNIT_END, UNIT_BODY, UNIT_DATA, UNIT_DONE, UNIT_FIRST, UNIT_HEAD, UNIT_LAST, UNIT_NONE, UNIT_PARM |
Constructor Summary | |
AsciiMessageWriter(java.io.Writer writer)
|
Method Summary | |
void |
close()
Closes this writer. |
void |
flush()
Flushes this writer. |
void |
writeMessage(Message msg)
Writes a message, including its end delimiter, in a thread-safe manner. |
void |
writeMessageEnd()
Writes the message end delimiter. |
void |
writeRawToken(java.lang.String string)
Writes a raw string to the current message unit. |
void |
writeToken(double number)
Writes a number token into the current message unit. |
void |
writeToken(long number)
Writes a number token into the current message unit. |
void |
writeToken(java.lang.String word)
Writes a word token into the current message unit. |
void |
writeUnit(java.lang.String data)
Writes a message unit into the current message, with data provided as a string. |
void |
writeUnitEnd()
Writes the message unit end delimiter. |
Methods inherited from class gumbo.net.msg.ascii.AsciiMessageIO |
currentUnit, nextUnit, resetUnit |
Methods inherited from class gumbo.net.msg.AbstractMessageIO |
addMessageIOListener, fireMessageRead, fireMessageWrite, getMessageIOListeners, removeMessageIOListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface gumbo.net.msg.MessageIO |
addMessageIOListener, getMessageIOListeners, removeMessageIOListener |
Constructor Detail |
public AsciiMessageWriter(java.io.Writer writer)
Method Detail |
public void writeToken(java.lang.String word) throws java.io.IOException, MessageIOException
word
- The word string. Can safely contain any characters including
whitespace (i.e. the string should not be quoted nor should characters
be escaped for message transport). If null an empty quoted token is
written.
java.io.IOException
- Writer is closed.
MessageIOException
- Message is done. Call writeMessageEnd() to
start a new message.public void writeToken(double number) throws java.io.IOException, MessageIOException
number
- The number value.
java.io.IOException
- Writer is closed.
MessageIOException
- Message is done. Call writeMessageEnd() to
start a new message.public void writeToken(long number) throws java.io.IOException, MessageIOException
number
- The number value.
java.io.IOException
- Writer is closed.
MessageIOException
- Message is done. Call writeMessageEnd() to
start a new message.public void writeRawToken(java.lang.String string) throws java.io.IOException, MessageIOException
string
- The raw string.
java.io.IOException
- Writer is closed.
MessageIOException
- Message is done. Call writeMessageEnd() to
start a new message.public void writeUnit(java.lang.String data) throws java.io.IOException, MessageIOException
data
- The unit data (i.e. without a unit delimiter).
java.io.IOException
- Writer is closed.
MessageIOException
- Too many units in message.public void writeUnitEnd() throws java.io.IOException, MessageIOException
java.io.IOException
- Writer is closed.
MessageIOException
- Message is done. Call writeMessageEnd() to
start a new message.public void writeMessageEnd() throws java.io.IOException, MessageIOException
java.io.IOException
- Writer is closed.
MessageIOException
- Too few units in message.public void flush() throws java.io.IOException
MessageWriter
flush
in interface MessageWriter
java.io.IOException
public void close() throws java.io.IOException
MessageWriter
close
in interface MessageWriter
java.io.IOException
public void writeMessage(Message msg) throws java.io.IOException, MessageIOException, MessageDataException
MessageWriter
writeMessage
in interface MessageWriter
MessageDataException
- Message is ill-formed for writing.
java.io.IOException
- Writer is closed.
MessageIOException
- Message stream is out of sync.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |