Public Member Functions | |
void | beginDecoding (InputStream istream) throws ContentDecodingException |
Initiates top-level decoding, handling any necessary initialization. | |
void | endDecoding () throws ContentDecodingException |
Completes top-level decoding, handling any necessary shutdown. | |
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) throws ContentDecodingException |
Reads an expected element start tag from the stream. | |
void | readStartElement (long startTag) throws ContentDecodingException |
Reads an expected element start tag from the stream. | |
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 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. | |
boolean | peekStartElement (String startTag) throws ContentDecodingException |
Peeks ahead in the stream to see if an expected element is next. | |
boolean | peekStartElement (long startTag) throws ContentDecodingException |
Peeks ahead in the stream to see if an expected element is next. | |
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. | |
void | readEndElement () throws ContentDecodingException |
Reads an end element from the stream, if this codec has end elements. | |
String | readUTF8Element (String startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Read a UTF-8 encoded string element from the stream. | |
String | readUTF8Element (long startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Read a UTF-8 encoded string element from the stream. | |
String | readUTF8Element (String startTag) throws ContentDecodingException |
Read a UTF-8 encoded string element which has no attributes from the stream. | |
String | readUTF8Element (long startTag) throws ContentDecodingException |
Read a UTF-8 encoded string element which has no attributes from the stream. | |
byte[] | readBinaryElement (String startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Read a binary element from the stream. | |
byte[] | readBinaryElement (long startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Read a binary element from the stream. | |
byte[] | readBinaryElement (String startTag) throws ContentDecodingException |
Read a binary element with no attributes from the stream. | |
byte[] | readBinaryElement (long startTag) throws ContentDecodingException |
Read a binary element with no attributes from the stream. | |
long | readLongElement (String startTag) throws ContentDecodingException |
Read and parse a number from the stream. | |
long | readLongElement (long startTag) throws ContentDecodingException |
Read and parse an integer from the stream. | |
int | readIntegerElement (String startTag) throws ContentDecodingException |
Read and parse a number from the stream. | |
int | readIntegerElement (long startTag) throws ContentDecodingException |
Read and parse an integer from the stream. | |
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. | |
String | readUString () throws ContentDecodingException |
Read UTF-8 string data starting from beginning of element (text element in text XML, type/value for UDATA in binary, etc). | |
byte[] | readBlob () throws ContentDecodingException |
Read BLOB data starting from beginning of element (encoded binary element in text XML, type/value for BLOB in binary, etc). | |
void | pushXMLDictionary (XMLDictionary dictionary) |
Some codecs use a dictionary to make encoding and decoding more efficient. | |
XMLDictionary | popXMLDictionary () |
Some codecs use a dictionary to make encoding and decoding more efficient. | |
InputStream | getInputStream () |
Get the decoder's input stream - needed for error recovery. |
The decoder implements this interface, the encoder must implement XMLEncoder. These do the work of encoding or decoding content. The ccnb binary encoding supports only a number of simple types, all codecs are limited to these same types for simplicity.
void org.ccnx.ccn.impl.encoding.XMLDecoder.beginDecoding | ( | InputStream | istream | ) | throws ContentDecodingException |
Initiates top-level decoding, handling any necessary initialization.
Calls readStartDocment() to read the document start.
istream | stream to decode from |
ContentDecodingException | if there is an error in decoding |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.endDecoding | ( | ) | throws ContentDecodingException |
Completes top-level decoding, handling any necessary shutdown.
Calls readEndDocment() to read the document end.
ContentDecodingException | if there is an error in decoding |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.readStartDocument | ( | ) | throws ContentDecodingException |
Reads the document start marker, if there is one.
ContentDecodingException | if there is an error in decoding |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.readEndDocument | ( | ) | throws ContentDecodingException |
Reads the document end marker, if there is one.
ContentDecodingException | if there is an error in decoding |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.readStartElement | ( | String | startTag | ) | throws ContentDecodingException |
Reads an expected element start tag from the stream.
startTag | next tag we expect to occur |
ContentDecodingException | if that tag does not occur, or another error is encountered |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.readStartElement | ( | long | startTag | ) | throws ContentDecodingException |
Reads an expected element start tag from the stream.
startTag | next tag we expect to occur |
ContentDecodingException | if that tag does not occur, or another error is encountered |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.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 |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.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 |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
boolean org.ccnx.ccn.impl.encoding.XMLDecoder.peekStartElement | ( | String | startTag | ) | throws ContentDecodingException |
Peeks ahead in the stream to see if an expected element is next.
Requires the underlying stream to return true from InputStream.markSupported(). Resets the stream to the point at which it was called afterwards
startTag | next tag we expect to occur |
ContentDecodingException | if an error is encountered |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
boolean org.ccnx.ccn.impl.encoding.XMLDecoder.peekStartElement | ( | long | startTag | ) | throws ContentDecodingException |
Peeks ahead in the stream to see if an expected element is next.
Requires the underlying stream to return true from InputStream.markSupported(). Resets the stream to the point at which it was called afterwards
startTag | next tag we expect to occur |
ContentDecodingException | if an error is encountered |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
String org.ccnx.ccn.impl.encoding.XMLDecoder.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 |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
Long org.ccnx.ccn.impl.encoding.XMLDecoder.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 |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.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 |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
String org.ccnx.ccn.impl.encoding.XMLDecoder.readUTF8Element | ( | String | startTag, | |
TreeMap< String, String > | attributes | |||
) | throws ContentDecodingException |
Read a UTF-8 encoded string element from the stream.
startTag | expected start tag | |
attributes | will be used to hold attributes on this tag, if there are any |
ContentDecodingException | if startTag is not the next tag in the stream, or there is an error decoding the element |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
String org.ccnx.ccn.impl.encoding.XMLDecoder.readUTF8Element | ( | long | startTag, | |
TreeMap< String, String > | attributes | |||
) | throws ContentDecodingException |
Read a UTF-8 encoded string element from the stream.
startTag | expected start tag | |
attributes | will be used to hold attributes on this tag, if there are any |
ContentDecodingException | if startTag is not the next tag in the stream, or there is an error decoding the element |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
String org.ccnx.ccn.impl.encoding.XMLDecoder.readUTF8Element | ( | String | startTag | ) | throws ContentDecodingException |
Read a UTF-8 encoded string element which has no attributes 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
String org.ccnx.ccn.impl.encoding.XMLDecoder.readUTF8Element | ( | long | startTag | ) | throws ContentDecodingException |
Read a UTF-8 encoded string element which has no attributes 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.XMLDecoder.readBinaryElement | ( | String | startTag, | |
TreeMap< String, String > | attributes | |||
) | throws ContentDecodingException |
Read a binary element from the stream.
startTag | expected start tag | |
attributes | will be used to hold attributes on this tag, if there are any |
ContentDecodingException | if startTag is not the next tag in the stream, or there is an error decoding the element |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.XMLDecoder.readBinaryElement | ( | long | startTag, | |
TreeMap< String, String > | attributes | |||
) | throws ContentDecodingException |
Read a binary element from the stream.
startTag | expected start tag | |
attributes | will be used to hold attributes on this tag, if there are any |
ContentDecodingException | if startTag is not the next tag in the stream, or there is an error decoding the element |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.XMLDecoder.readBinaryElement | ( | String | startTag | ) | throws ContentDecodingException |
Read a binary element with no attributes 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.XMLDecoder.readBinaryElement | ( | long | startTag | ) | throws ContentDecodingException |
Read a binary element with no attributes 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
long org.ccnx.ccn.impl.encoding.XMLDecoder.readLongElement | ( | String | startTag | ) | throws ContentDecodingException |
Read and parse a number 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
long org.ccnx.ccn.impl.encoding.XMLDecoder.readLongElement | ( | long | startTag | ) | throws ContentDecodingException |
Read and parse an integer 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
int org.ccnx.ccn.impl.encoding.XMLDecoder.readIntegerElement | ( | String | startTag | ) | throws ContentDecodingException |
Read and parse a number 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
int org.ccnx.ccn.impl.encoding.XMLDecoder.readIntegerElement | ( | long | startTag | ) | throws ContentDecodingException |
Read and parse an integer 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 |
Implemented in org.ccnx.ccn.impl.encoding.GenericXMLDecoder.
CCNTime org.ccnx.ccn.impl.encoding.XMLDecoder.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 |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
CCNTime org.ccnx.ccn.impl.encoding.XMLDecoder.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 |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
String org.ccnx.ccn.impl.encoding.XMLDecoder.readUString | ( | ) | throws ContentDecodingException |
Read UTF-8 string data starting from beginning of element (text element in text XML, type/value for UDATA in binary, etc).
Consumes the end element (text has to, so we copy).
ContentDecodingException |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.XMLDecoder.readBlob | ( | ) | throws ContentDecodingException |
Read BLOB data starting from beginning of element (encoded binary element in text XML, type/value for BLOB in binary, etc).
Consumes the end element (text has to, so we copy).
ContentDecodingException |
Implemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
void org.ccnx.ccn.impl.encoding.XMLDecoder.pushXMLDictionary | ( | XMLDictionary | dictionary | ) |
Some codecs use a dictionary to make encoding and decoding more efficient.
Those codecs typically load their default dictionary automatically. This call allows a user to manipulate the dictionary stack, adding their own dictionaries to the set used to decode.
dictionary | a dictionary to add to the set used for decoding |
XMLDictionary org.ccnx.ccn.impl.encoding.XMLDecoder.popXMLDictionary | ( | ) |
Some codecs use a dictionary to make encoding and decoding more efficient.
Those codecs typically load their default dictionary automatically. This call allows a user to manipulate the dictionary stack, removing the most recently added dictionary from the set used to decode.