|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.org.ury.protocol.ProtocolUtils
public class ProtocolUtils
Utilities for converting between strings encoded in the response protocol and collections of items, as well as validating and unpicking protocol messages.
Constructor Summary | |
---|---|
ProtocolUtils()
|
Method Summary | |
---|---|
static java.util.Map<?,?> |
decode(java.lang.String string)
Decode a protocol string into a key-value map. |
static java.lang.String |
encode(java.util.Map<java.lang.String,java.lang.Object> items)
Encode a key-value map into a protocol string. |
static boolean |
responseIsOK(java.util.Map<?,?> response)
Check if a response is flagged as having OK status. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProtocolUtils()
Method Detail |
---|
public static java.lang.String encode(java.util.Map<java.lang.String,java.lang.Object> items)
items
- The key-value map of items, which should contain strings,
lists and maps. The keys of any map should be protocol
directives.
public static java.util.Map<?,?> decode(java.lang.String string) throws DecodeFailureException
string
- The string to decode.
DecodeFailureException
- if the decoding engine returns something other than a map.public static boolean responseIsOK(java.util.Map<?,?> response) throws InvalidMessageException
response
- The response message, as a key-value map (eg in decoded
format).
InvalidMessageException
- if the response is invalid (eg the status is missing).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |