|
|||||||||||
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.AsciiMessageReader
Reads ASCII message elements (units, tokens, delimiters) from a reader.
Note that the StreamTokenizer returns the quote character, not TT_WORD, when a quoted word token is read. This is a crucial point that is sorely missing in the javadoc.
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 | |
AsciiMessageReader(java.io.Reader reader)
|
Method Summary | |
void |
atUnitEnd(int ttype)
Used to verify that a special character read in a unit was the unit end. |
void |
close()
Closes this message reader. |
double |
getTokenNumber()
Gets the number in the token last read by readToken(). |
java.lang.String |
getTokenWord()
Gets the word in the token last read by readToken(). |
Message |
readMessage()
Reads a message, including its end delimiter, in a thread-safe manner. |
void |
readMessageEnd()
Reads the message end delimiter, skipping any white space. |
int |
readToken()
Reads the next token in the current message unit. |
java.lang.String |
readUnit()
Reads the next message unit (head, parameters, or body) and returns its data as a string. |
void |
readUnitEnd()
Reads the message unit end delimiter, skipping any white space. |
void |
syncMessageEnd()
Reads the current message to its end. |
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 AsciiMessageReader(java.io.Reader reader)
Method Detail |
public int readToken() throws java.io.IOException, MessageIOException
java.io.IOException
- Reader is closed.
MessageIOException
- Message ended before unit or message is done.public java.lang.String getTokenWord() throws MessageIOException
MessageIOException
- readToken() not yet called or did not read
a word.public double getTokenNumber() throws MessageIOException
MessageIOException
- readToken() not yet called or did not read
a number.public java.lang.String readUnit() throws java.io.IOException, MessageIOException
java.io.IOException
- Reader is closed.
MessageIOException
- Message ended before unit or too many units
for message.public void readUnitEnd() throws java.io.IOException, MessageIOException
java.io.IOException
- Reader is closed.
MessageIOException
- Unit is not at the end (i.e. other data
found).public void atUnitEnd(int ttype) throws java.io.IOException, MessageIOException
ttype
- Ttype from a parser.
java.io.IOException
- Reader is closed.
MessageIOException
- Unit is not at the end (i.e. other data
found).public void readMessageEnd() throws java.io.IOException, MessageIOException
java.io.IOException
- Reader is closed.
MessageIOException
- Message is not at the end (i.e. other data
found) or too few units for message.public void close() throws java.io.IOException
MessageReader
close
in interface MessageReader
java.io.IOException
public Message readMessage() throws java.io.IOException, MessageIOException, MessageDataException
MessageReader
readMessage
in interface MessageReader
java.io.IOException
- Reader is closed.
MessageIOException
- Message end not found.
MessageDataException
- Message data corrupted.public void syncMessageEnd() throws java.io.IOException, MessageIOException
MessageReader
syncMessageEnd
in interface MessageReader
java.io.IOException
- Reader is closed.
MessageIOException
- Message end not found (which should never
happen).
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |