Methods Summary |
---|
protected abstract BasicMessage | buildMessage(java.lang.String msgId)
|
public BasicMessage | readMsg()
BasicMessage msg;
if (tokenizer.nextToken() == StreamTokenizer.TT_WORD) {
String msgId = tokenizer.sval;
msg = buildMessage(msgId);
if (msg.readArgs(msgIn)) {
return msg;
}
else {
msg = null;
}
}
else {
return null;
}
return msg;
|
public void | run()
try {
while (true) {
BasicMessage msg = readMsg();
msg.Do();
}
}
// Treat an IOException as a termination of the message
// exchange, and let this message-processing thread die.
catch (IOException e) {}
|
public void | sendMsg(BasicMessage msg)
boolean success = true;
DataOutputStream dout = new DataOutputStream(msgOut);
char delim = tokenDelim.charAt(0);
dout.writeUTF(msg.messageID());
msg.writeArgs(msgOut);
|
protected void | setStreams(java.io.InputStream in, java.io.OutputStream out)
msgIn = in;
msgOut = out;
// Wrap the input stream with a tokenizer
tokenizer = new StreamTokenizer(msgIn);
// Set the token delimiting characters on the tokenizer
int len = tokenDelim.length();
for (int i = 0; i < len; i++)
tokenizer.whitespaceChars(tokenDelim.charAt(i), tokenDelim.charAt(i));
|