An implementation of XMLDecoder for the Text codec. More...
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 |
An implementation of XMLDecoder for the Text codec.
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().
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().
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.
startTag | expected start tag |
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.
startTag | expected start tag |
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.
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.
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.
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.
startTag | next tag we expect to occur | |
attributes | map into which we store (attribute, value) pairs |
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.
startTag | next tag we expect to occur | |
attributes | map into which we store (attribute, value) pairs |
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.
ContentDecodingException | if there is a problem decoding the data |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.