Public Member Functions | |
GenericXMLDecoder (XMLDictionary dictionary) | |
void | beginDecoding (InputStream istream) throws ContentDecodingException |
Initiates top-level decoding, handling any necessary initialization. | |
void | initializeDecoding () throws ContentDecodingException |
Default implementation does nothing. | |
void | endDecoding () throws ContentDecodingException |
Completes top-level decoding, handling any necessary shutdown. | |
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. | |
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 | 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. | |
String | readUTF8Element (String startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Force low-level readers to all consume the end element, to get behavior matching the text decoder (lowest common denominator); allows us to collapse this level of behavior here. | |
String | readUTF8Element (long startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Force low-level readers to all consume the end element, to get behavior matching the text decoder (lowest common denominator); allows us to collapse this level of behavior here. | |
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. | |
byte[] | readBinaryElement (String startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Expect a start tag (label), optional attributes, a BLOB, and an end element. | |
byte[] | readBinaryElement (long startTag, TreeMap< String, String > attributes) throws ContentDecodingException |
Force low-level readers to all consume the end element, to get behavior matching the text decoder (lowest common denominator); allows us to collapse this level of behavior here. | |
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. | |
InputStream | getInputStream () |
Get the decoder's input stream - needed for error recovery. | |
Protected Attributes | |
InputStream | _istream = null |
void org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
void org.ccnx.ccn.impl.encoding.GenericXMLDecoder.initializeDecoding | ( | ) | throws ContentDecodingException |
Default implementation does nothing.
Subclass-specific parser setup.
Reimplemented in org.ccnx.ccn.impl.encoding.BinaryXMLDecoder, and org.ccnx.ccn.impl.encoding.TextXMLDecoder.
void org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
void org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
void org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
boolean org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
boolean org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
String org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
String org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
byte [] org.ccnx.ccn.impl.encoding.GenericXMLDecoder.readBinaryElement | ( | String | startTag, | |
TreeMap< String, String > | attributes | |||
) | throws ContentDecodingException |
Expect a start tag (label), optional attributes, a BLOB, and an end element.
Force low-level readers to all consume the end element, to get behavior matching the text decoder (lowest common denominator); allows us to collapse this level of behavior here.
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
long org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
long org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
int org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.
int org.ccnx.ccn.impl.encoding.GenericXMLDecoder.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 |
Implements org.ccnx.ccn.impl.encoding.XMLDecoder.