org.ccnx.ccn.impl.encoding.XMLEncodable Interface Reference

Top-level interface implemented by objects that want to make use of our stream encoding and decoding infrastructure. More...

Inheritance diagram for org.ccnx.ccn.impl.encoding.XMLEncodable:

org.ccnx.ccn.impl.encoding.GenericXMLEncodable org.ccnx.ccn.impl.repo.PolicyXML org.ccnx.ccn.impl.repo.RepositoryInfo org.ccnx.ccn.io.content.Collection org.ccnx.ccn.io.content.Header org.ccnx.ccn.io.content.Link org.ccnx.ccn.io.content.LinkAuthenticator org.ccnx.ccn.io.content.WrappedKey org.ccnx.ccn.protocol.ContentName org.ccnx.ccn.protocol.ContentObject org.ccnx.ccn.protocol.Exclude org.ccnx.ccn.protocol.Exclude.Element org.ccnx.ccn.protocol.Interest org.ccnx.ccn.protocol.KeyLocator org.ccnx.ccn.protocol.KeyName org.ccnx.ccn.protocol.PublisherID org.ccnx.ccn.protocol.PublisherPublicKeyDigest org.ccnx.ccn.protocol.Signature org.ccnx.ccn.protocol.SignedInfo org.ccnx.ccn.protocol.WirePacket

List of all members.

Public Member Functions

void decode (InputStream istream) throws ContentDecodingException
 Decode this object as the top-level item in a new XML document, reading it from an InputStream.
void decode (InputStream istream, String codec) throws ContentDecodingException
 Decode this object as the top-level item in a new XML document, reading it from an InputStream.
void decode (byte[] objectBuffer) throws ContentDecodingException
 Helper method to decode from a byte array rather than an InputStream.
void decode (byte[] objectBuffer, String codec) throws ContentDecodingException
 Helper method to decode from a byte array rather than an InputStream.
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 (OutputStream ostream) throws ContentEncodingException
 Encode this object as the top-level item in a new XML document.
void encode (OutputStream ostream, String codec) throws ContentEncodingException
 Encode this object as the top-level item in a new XML document.
byte[] encode () throws ContentEncodingException
 Helper method to encode to a byte array rather than an OutputStream.
byte[] encode (String codec) throws ContentEncodingException
 Helper method to encode to a byte array rather than an OutputStream.
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.


Detailed Description

Top-level interface implemented by objects that want to make use of our stream encoding and decoding infrastructure.

Note - this uses a compact binary encoding (ccnb) normally rather than text XML.

The choice between compact binary encoding and text encoding is made for the general case using a system-wide configuration parameter set in SystemConfiguration. Subclasses wishing to can use this infrastructure for encoding/decoding objects that should be read/edited by users can force their particular subtype to always use the text encoding; or callers that read/write that data can specify the text encoding when reading or writing. The latter is the better option, as it allows the underlying content to use the compact binary encoding in settings where that would be preferable, without needing to modify the code. See GenericXMLEncodable.toString() for an example.

Most classes wishing to make use of this infrastructure will do so by subclassing GenericXMLEncodable, which provides default implementations of almost all of the necessary behavior, leaving very little work for the class implementor to do. For examples, see existing subclasses of GenericXMLEncodable.

See also:
SystemConfiguration

GenericXMLEncodable


Member Function Documentation

void org.ccnx.ccn.impl.encoding.XMLEncodable.decode ( InputStream  istream  )  throws ContentDecodingException

Decode this object as the top-level item in a new XML document, reading it from an InputStream.

Reads document start and end. Assumes default encoding.

Parameters:
istream input stream to read from
Exceptions:
ContentDecodingException if there is an error decoding the content

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.impl.encoding.XMLEncodable.decode ( InputStream  istream,
String  codec 
) throws ContentDecodingException

Decode this object as the top-level item in a new XML document, reading it from an InputStream.

Reads document start and end.

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

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.impl.encoding.XMLEncodable.decode ( byte[]  objectBuffer  )  throws ContentDecodingException

Helper method to decode from a byte array rather than an InputStream.

Decode this object as the top-level item in a new XML document. Reads document start and end. Assumes default encoding.

Parameters:
objectBuffer input buffer to read from
Exceptions:
ContentDecodingException if there is an error decoding the content
See also:
decode(InputStream)

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.impl.encoding.XMLEncodable.decode ( byte[]  objectBuffer,
String  codec 
) throws ContentDecodingException

Helper method to decode from a byte array rather than an InputStream.

Decode this object as the top-level item in a new XML document. Reads document start and end.

Parameters:
objectBuffer input buffer 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:
decode(InputStream,String)

XMLCodecFactory

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.impl.encoding.XMLEncodable.decode ( XMLDecoder  decoder  )  throws ContentDecodingException

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

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable, org.ccnx.ccn.impl.repo.PolicyXML, org.ccnx.ccn.impl.repo.RepositoryInfo, org.ccnx.ccn.io.content.Collection, org.ccnx.ccn.io.content.ConfigSlice.Filter, org.ccnx.ccn.io.content.ConfigSlice, org.ccnx.ccn.io.content.Header, org.ccnx.ccn.io.content.Link, org.ccnx.ccn.io.content.LinkAuthenticator, org.ccnx.ccn.io.content.WrappedKey, org.ccnx.ccn.profiles.security.access.AccessControlPolicyMarker, org.ccnx.ccn.protocol.BloomFilter, org.ccnx.ccn.protocol.ContentName, org.ccnx.ccn.protocol.ContentObject, org.ccnx.ccn.protocol.Exclude, org.ccnx.ccn.protocol.ExcludeAny, org.ccnx.ccn.protocol.ExcludeComponent, org.ccnx.ccn.protocol.Interest, org.ccnx.ccn.protocol.KeyLocator, org.ccnx.ccn.protocol.KeyName, org.ccnx.ccn.protocol.PublisherID, org.ccnx.ccn.protocol.PublisherPublicKeyDigest, org.ccnx.ccn.protocol.Signature, org.ccnx.ccn.protocol.SignedInfo, and org.ccnx.ccn.protocol.WirePacket.

void org.ccnx.ccn.impl.encoding.XMLEncodable.encode ( OutputStream  ostream  )  throws ContentEncodingException

Encode this object as the top-level item in a new XML document.

Writes start and end document. Assumes default encoding.

Parameters:
ostream stream to encode object to
Exceptions:
ContentEncodingException if there is an error encoding the object

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.impl.encoding.XMLEncodable.encode ( OutputStream  ostream,
String  codec 
) throws ContentEncodingException

Encode this object as the top-level item in a new XML document.

Writes start and end document.

Parameters:
ostream stream to encode object to
codec the codec to use; must be recognized by XMLCodecFactory
Exceptions:
ContentEncodingException if there is an error encoding the object
See also:
XMLCodecFactory

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

byte [] org.ccnx.ccn.impl.encoding.XMLEncodable.encode (  )  throws ContentEncodingException

Helper method to encode to a byte array rather than an OutputStream.

Encode this object as the top-level item in a new XML document. Writes document start and end. Assumes default encoding.

Returns:
returns the encoded object
Exceptions:
ContentEncodingException if there is an error encoding the content
See also:
encode(OutputStream)

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

byte [] org.ccnx.ccn.impl.encoding.XMLEncodable.encode ( String  codec  )  throws ContentEncodingException

Helper method to encode to a byte array rather than an OutputStream.

Encode this object as the top-level item in a new XML document. Writes document start and end.

Parameters:
codec the codec to use; must be recognized by XMLCodecFactory
Returns:
returns the encoded object
Exceptions:
ContentEncodingException if there is an error encoding the content
See also:
encode(OutputStream,String)

XMLCodecFactory

Implemented in org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.impl.encoding.XMLEncodable.encode ( XMLEncoder  encoder  )  throws ContentEncodingException

long org.ccnx.ccn.impl.encoding.XMLEncodable.getElementLabel (  ) 

boolean org.ccnx.ccn.impl.encoding.XMLEncodable.validate (  ) 


The documentation for this interface was generated from the following file:

Generated on Thu Feb 16 00:44:53 2012 for Content-Centric Networking in Java by  doxygen 1.5.6