Classes | |
class | KeyOrderComparator |
This can be used in a data structure to order KV pairs by their keys. More... | |
Public Member Functions | |
KeyValuePair (String key, Object value) | |
Encoder/Decoder for arbitrary key value pairs of type Integer, Float, String, or byte[]. | |
String | getKey () |
Object | getValue () |
void | decode (XMLDecoder decoder) throws ContentDecodingException |
Decode this object as the top-level item in a new XML document, reading it from a network buffer. | |
void | encode (XMLEncoder encoder) throws ContentEncodingException |
Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement. | |
long | getElementLabel () |
Allow the encoder/decoder to retrieve the top-level element name programmatically. | |
boolean | validate () |
Make sure all of the necessary fields are filled in prior to attempting to encode. | |
int | compareTo (KeyValuePair o) |
Compares based on _key first. | |
boolean | equals (Object obj) |
int | hashCode () |
Object | setValue (Object value) |
Protected Attributes | |
String | _key |
Object | _value |
org.ccnx.ccn.io.content.KeyValuePair.KeyValuePair | ( | String | key, | |
Object | value | |||
) |
Encoder/Decoder for arbitrary key value pairs of type Integer, Float, String, or byte[].
key | ||
value |
InvalidTypeException |
int org.ccnx.ccn.io.content.KeyValuePair.compareTo | ( | KeyValuePair | o | ) |
Compares based on _key first.
If keys equal, then compares based on _value. Nulls are treated as equals, otherwise Null < non-Null.
The Comparison on _value requires the class of _value to be the same. If you try to compare keys with different classes for _value, compareTo will return a consistent ordering based on class, not on the value of _value (i.e. ordering by canonical class name). If _value is of type byte[], then the ordering is a shortlex.
void org.ccnx.ccn.io.content.KeyValuePair.decode | ( | XMLDecoder | decoder | ) | throws ContentDecodingException [virtual] |
Decode this object as the top-level item in a new XML document, reading it from a network buffer.
Reads document start and end. Assumes default encoding.
buf | input stream to read from |
ContentDecodingException | if there is an error decoding the content Decode this object as the top-level item in a new XML document, reading it from a network buffer. Reads document start and end. |
buf | input stream to read from | |
codec | the codec to use; must be recognized by XMLCodecFactory |
ContentDecodingException | if there is an error decoding the content |
decoder | the decoder being used; encapsulates state including the codec being used as well as the input source and current offset |
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
void org.ccnx.ccn.io.content.KeyValuePair.encode | ( | XMLEncoder | encoder | ) | throws ContentEncodingException [virtual] |
Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement.
Writes just the object itself, higher-level processes have handled start and end document if need be. Allows object to be written using the same code whether it is a top-level element written alone, or nested inside another element.
encoder | the encoder being used; encapsulates state including the codec being used as well as the output destination and current offset |
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
long org.ccnx.ccn.io.content.KeyValuePair.getElementLabel | ( | ) | [virtual] |
Allow the encoder/decoder to retrieve the top-level element name programmatically.
This allows subclasses to rename elements without changing their encoder/decoders.
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
boolean org.ccnx.ccn.io.content.KeyValuePair.validate | ( | ) | [virtual] |
Make sure all of the necessary fields are filled in prior to attempting to encode.
All implementations of encode(XMLEncoder) should call this for their classes prior to encoding.
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.