org.ccnx.ccn.impl.encoding.TextXMLDecoder Class Reference

An implementation of XMLDecoder for the Text codec. More...

List of all members.

Public Member Functions

 TextXMLDecoder (BinaryXMLDictionary dictionary)
void initializeDecoding () throws ContentDecodingException
 Default implementation does nothing.
void readStartDocument () throws ContentDecodingException
 Reads the document start marker, if there is one.
void readEndDocument () throws ContentDecodingException
 Reads the document end marker, if there is one.
void readStartElement (String startTag, TreeMap< String, String > attributes) throws ContentDecodingException
 Reads an expected element start tag from the stream, extracting any attributes that are present on the tag.
void readStartElement (long startTagLong, TreeMap< String, String > attributes) throws ContentDecodingException
 Reads an expected element start tag from the stream, extracting any attributes that are present on the tag.
String peekStartElementAsString () throws ContentDecodingException
 Pulls the next tag out of the stream and then resets the stream to the point before that tag.
Long peekStartElementAsLong () throws ContentDecodingException
 Pulls the next tag out of the stream and then resets the stream to the point before that tag.
String readUString () throws ContentDecodingException
 Helper method to decode text (UTF-8) and binary elements.
void readEndElement () throws ContentDecodingException
 Reads an end element from the stream, if this codec has end elements.
byte[] readBlob () throws ContentDecodingException
 Read a BLOB.
CCNTime readDateTime (String startTag) throws ContentDecodingException
 Read and parse a timestamp from the stream.
CCNTime readDateTime (long startTag) throws ContentDecodingException
 Read and parse a timestamp from the stream.

Protected Attributes

XmlPullParser _reader = null

Detailed Description

An implementation of XMLDecoder for the Text codec.

See also:
TextXMLCodec
XMLDecoder

Member Function Documentation

void org.ccnx.ccn.impl.encoding.TextXMLDecoder.initializeDecoding (  )  throws ContentDecodingException

Default implementation does nothing.

Subclass-specific parser setup.

Reimplemented from org.ccnx.ccn.impl.encoding.GenericXMLDecoder.

Long org.ccnx.ccn.impl.encoding.TextXMLDecoder.peekStartElementAsLong (  )  throws ContentDecodingException

Pulls the next tag out of the stream and then resets the stream to the point before that tag.

Requires the underlying stream to return true from InputStream.markSupported().

Returns:
the next tag found, or null if not a start element
Exceptions:
ContentDecodingException if there is an error reading the stream or decoding the tag

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

String org.ccnx.ccn.impl.encoding.TextXMLDecoder.peekStartElementAsString (  )  throws ContentDecodingException

Pulls the next tag out of the stream and then resets the stream to the point before that tag.

Requires the underlying stream to return true from InputStream.markSupported().

Returns:
the next tag found
Exceptions:
ContentDecodingException if there is an error reading the stream or decoding the tag

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

byte [] org.ccnx.ccn.impl.encoding.TextXMLDecoder.readBlob (  )  throws ContentDecodingException

Read a BLOB.

Consumes the end element, so force other versions to match.

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

CCNTime org.ccnx.ccn.impl.encoding.TextXMLDecoder.readDateTime ( long  startTag  )  throws ContentDecodingException

Read and parse a timestamp from the stream.

Parameters:
startTag expected start tag
Returns:
the decoded timestamp, using a quantized CCNTime
Exceptions:
ContentDecodingException if startTag is not the next tag in the stream, or there is an error decoding the element or parsing the integer

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

CCNTime org.ccnx.ccn.impl.encoding.TextXMLDecoder.readDateTime ( String  startTag  )  throws ContentDecodingException

Read and parse a timestamp from the stream.

Parameters:
startTag expected start tag
Returns:
the decoded timestamp, using a quantized CCNTime
Exceptions:
ContentDecodingException if startTag is not the next tag in the stream, or there is an error decoding the element or parsing the integer

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

void org.ccnx.ccn.impl.encoding.TextXMLDecoder.readEndDocument (  )  throws ContentDecodingException

Reads the document end marker, if there is one.

Exceptions:
ContentDecodingException if there is an error in decoding

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

void org.ccnx.ccn.impl.encoding.TextXMLDecoder.readEndElement (  )  throws ContentDecodingException

Reads an end element from the stream, if this codec has end elements.

Exceptions:
ContentDecodingException if the next element in the stream is not an end element, or there is another error reading

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

void org.ccnx.ccn.impl.encoding.TextXMLDecoder.readStartDocument (  )  throws ContentDecodingException

Reads the document start marker, if there is one.

Exceptions:
ContentDecodingException if there is an error in decoding

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

void org.ccnx.ccn.impl.encoding.TextXMLDecoder.readStartElement ( long  startTag,
TreeMap< String, String >  attributes 
) throws ContentDecodingException

Reads an expected element start tag from the stream, extracting any attributes that are present on the tag.

Parameters:
startTag next tag we expect to occur
attributes map into which we store (attribute, value) pairs
Exceptions:
ContentDecodingException if that tag does not occur, or another error is encountered

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

void org.ccnx.ccn.impl.encoding.TextXMLDecoder.readStartElement ( String  startTag,
TreeMap< String, String >  attributes 
) throws ContentDecodingException

Reads an expected element start tag from the stream, extracting any attributes that are present on the tag.

Parameters:
startTag next tag we expect to occur
attributes map into which we store (attribute, value) pairs
Exceptions:
ContentDecodingException if that tag does not occur, or another error is encountered

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.

String org.ccnx.ccn.impl.encoding.TextXMLDecoder.readUString (  )  throws ContentDecodingException

Helper method to decode text (UTF-8) and binary elements.

Consumes the end element, behavior which other decoders are forced to match.

Returns:
the read data, as a String
Exceptions:
ContentDecodingException if there is a problem decoding the data

Implements org.ccnx.ccn.impl.encoding.XMLDecoder.


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