|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.deas.hyperenc.MessageParser
edu.harvard.deas.hyperenc.PlainTextMessageParser
public class PlainTextMessageParser
Parses plain-text representations of hyper-encryption protocol messages according to the following specification:
Master reconciliation message: Each line contains one ID-hash pair. The integer ID comes first, followed by a single space, followed by the hash, encoded as a hexadecimal number using digits 0-9 and a-f (case-insensitive).
Slave reconciliation message: Each line contains one ID-code pair. The integer ID comes first, followed by a single space, followed by a result code, which must be one of the following single-character strings:
SlaveRecResult
Constructor Summary | |
---|---|
PlainTextMessageParser()
|
Method Summary | |
---|---|
String |
mrecToString(List<Pair<Integer,byte[]>> lst)
Converts a master reconciliation message hash list into a string. |
List<Pair<Integer,byte[]>> |
parseMRec(String message)
Converts the raw contents of a master reconciliation message into a list of pairs; each pair contains an integer ID identifying a page, and the hash of that page. |
List<Pair<Integer,SlaveRecResult>> |
parseSRec(String message)
Converts the raw contents of a slave reconciliation message into a list of pairs; each pair contains an integer ID identifying a page, and a code indicating the result of the reconciliation. |
String |
srecToString(List<Pair<Integer,SlaveRecResult>> lst)
Converts a slave reconciliation message hash list into a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlainTextMessageParser()
Method Detail |
---|
public List<Pair<Integer,byte[]>> parseMRec(String message) throws MessageParseException
MessageParser
parseMRec
in class MessageParser
message
- the raw message
MessageParseException
- if message
cannot be parsedpublic List<Pair<Integer,SlaveRecResult>> parseSRec(String message) throws MessageParseException
MessageParser
parseSRec
in class MessageParser
message
- the raw message
MessageParseException
- if message
cannot be parsedpublic String mrecToString(List<Pair<Integer,byte[]>> lst)
MessageParser
parseMRec
; passing a list to this
method, then parsing the returned string with parseMRec
yields
a list equivalent to the original.
mrecToString
in class MessageParser
lst
- a list of ID-hash pairs
public String srecToString(List<Pair<Integer,SlaveRecResult>> lst)
parseSRec
; passing a list to this
method, then parsing the returned string with parseSRec
yields
a list equivalent to the original.
srecToString
in class MessageParser
lst
- a list of ID-result code pairs
IllegalArgumentException
- if a result in lst
is not supported by this parser
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |