org.ccnx.ccn.io.content.KeyValueSet Class Reference

List of all members.

Classes

class  KeyValueSetObject
 A CCNNetworkObject wrapper around KeyValueSet, used for easily saving and retrieving versioned KeyValueSets to CCN. More...

Public Member Functions

 KeyValueSet (Properties propertySet)
 Create a KeyValueSet and initialize its contents to match that of a Java Properties collection.
 KeyValueSet (Map< String, Object > values)
 Create a KeyValueSet and initialize its contents to that of a collection.
Object put (String key, Object value)
 Add a new key value pair to the set.
Object get (String key)
int size ()
void clear ()
boolean containsKey (Object key)
boolean containsValue (Object value)
Set< java.util.Map.Entry
< String, Object > > 
entrySet ()
Object get (Object key)
boolean isEmpty ()
Set< String > keySet ()
void putAll (Map<?extends String,?extends Object > t)
Object remove (Object key)
Collection< Object > values ()
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.
boolean equals (Object obj)
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.

Protected Attributes

TreeMap< String, KeyValuePair_set = new TreeMap<String, KeyValuePair>()

Constructor & Destructor Documentation

org.ccnx.ccn.io.content.KeyValueSet.KeyValueSet ( Properties  propertySet  ) 

Create a KeyValueSet and initialize its contents to match that of a Java Properties collection.

Parameters:
propertySet 
org.ccnx.ccn.io.content.KeyValueSet.KeyValueSet ( Map< String, Object >  values  ) 

Create a KeyValueSet and initialize its contents to that of a collection.

Parameters:
propertySet 

Member Function Documentation

void org.ccnx.ccn.io.content.KeyValueSet.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.

Parameters:
buf input stream to read from
Exceptions:
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.
Parameters:
buf input stream to read from
codec the codec to use; must be recognized by XMLCodecFactory
Exceptions:
ContentDecodingException if there is an error decoding the content
See also:
XMLCodecFactory Decode this object during an ongoing decoding pass; this is what subclasses generally need to know how to implement. Reads just the object itself, higher-level processes have handled start and end document if need be. Allows object to be read using the same code whether it is a top-level element written alone, or nested inside another element.
Parameters:
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.KeyValueSet.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.

Parameters:
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.

Object org.ccnx.ccn.io.content.KeyValueSet.get ( String  key  ) 
Parameters:
key key of the Object to get
Returns:
the value
long org.ccnx.ccn.io.content.KeyValueSet.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.

Returns:
the element label to use, as a key in a loaded encoding dictionary

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

Object org.ccnx.ccn.io.content.KeyValueSet.put ( String  key,
Object  value 
)

Add a new key value pair to the set.

Parameters:
key key for the value
value the value - may be Integer, Float, String, byte[], or ContentName
boolean org.ccnx.ccn.io.content.KeyValueSet.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.

Returns:
true if object is valid and can be encoded, false if there is a problem; for example mandatory fields are uninitialized

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.


The documentation for this class was generated from the following file:
Generated on Fri May 13 16:27:45 2011 for Content-Centric Networking in Java by  doxygen 1.6.3