Class Decoder
- All Implemented Interfaces:
FastInfosetParser
- Direct Known Subclasses:
DOMDocumentParser,SAXDocumentParser,StAXDocumentParser
This class extends org.sax.xml.DefaultHandler so that concrete SAX implementations can be used with javax.xml.parsers.SAXParser and the parse methods that take org.sax.xml.DefaultHandler as a parameter.
Buffering of octets that are read from an InputStream is
supported in a similar manner to a BufferedInputStream.
Combining buffering with decoding enables better performance.
More than one fast infoset document may be decoded from the
InputStream.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanTrue if an entry is required to be added to a tableprotected QualifiedNameArrayThe attribute name table of the vocabulary.protected StringArrayThe attribute value table of the vocabulary.protected intThe current octet that is being readprotected intThe size of the internal buffer.protected ContiguousCharArrayArrayThe character content chunk table of the vocabulary.protected char[]The internal buffer of characters.protected intThe length of characters in the buffer of characters.protected booleanTrue if two information item are terminated in direct sequence.protected DuplicateAttributeVerifierHelper class that checks for duplicate attribute information items.protected QualifiedNameArrayThe element name table of the vocabulary.protected intThe vocabulary table index of identifying string or the identifier of an encoding algorithm or restricted alphabet.protected intThe vocabulary table index to an indexed non identifying string.protected intprotected booleanTrue if needs to close underlying input stream.protected ListThe list of Notation Information Items that are part of the Document Information Item.protected byte[]The internal buffer used for decoding.protected intThe end of the buffer.protected intThe length of some octets in the buffer that are to be read.protected intThe offset into the buffer to read the next byte.protected intA mark into the internal buffer used for decoding encoded algorithm or restricted alphabet data.protected booleanTrue if can parse fragments.protected intprotected PrefixArrayThe prefix table of the vocabulary.protected MapThe map of URIs to registered encoding algorithms.protected booleanTrue if an information item is terminated.protected ListThe list of Unparsed Entity Information Items that are part of the Document Information Item.protected ParserVocabularyThe vocabulary used for decoding.static final StringInternal buffer size interning system property.protected static final intprotected static final intprotected static final intprotected static final intstatic final StringString interning system property.Fields inherited from interface org.jvnet.fastinfoset.FastInfosetParser
BUFFER_SIZE_PROPERTY, EXTERNAL_VOCABULARIES_PROPERTY, FORCE_STREAM_CLOSE_PROPERTY, REGISTERED_ENCODING_ALGORITHMS_PROPERTY, STRING_INTERNING_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanprotected final voidprotected StringcreateQualifiedNameString(char[] first, String second) protected StringcreateQualifiedNameString(String second) protected final voidprotected final voiddecodeAlphabetOctetsAsCharBuffer(char[] restrictedAlphabet) protected final Stringprotected final voidprotected final QualifiedNameprotected final QualifiedNameprotected final voiddecodeFourBitAlphabetOctetsAsCharBuffer(char[] restrictedAlphabet) protected final voidprotected final StringdecodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(boolean prefixPresent) protected final StringdecodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix(boolean namespaceNamePresent) protected final Stringprotected final StringdecodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(boolean prefixPresent) protected final StringdecodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(boolean namespaceNamePresent) protected final voidprotected final intprotected final QualifiedNamedecodeLiteralQualifiedName(int state, QualifiedName q) protected final voidprotected final voidprotected final Stringprotected final intprotected final voidprotected final voidprotected final voidprotected final StringdecodeRAOctetsAsString(char[] restrictedAlphabet) protected final voidprotected final Stringprotected final voidprotected final voidprotected final Stringprotected final voidprotected final voidprotected final voiddecodeUtf8StringAsCharBuffer(char[] ch, int offset) protected final Stringprotected final voidprotected final voiddecodeUtf8StringIntoCharBuffer(char[] ch, int offset) protected final StringintGet the buffer size.Get the map of referenced external vocabularies.booleanReturn the force stream close property.booleanReturn the parse fragments property.Gets the set of registered encoding algorithms.booleanReturn the string interning property.static booleanprotected final intpeek()protected final intpeek(OctetBufferListener octetBufferListener) protected final intpeek2(OctetBufferListener octetBufferListener) protected final intread()voidreset()Reset the decoder for reuse decoding another XML infoset.voidsetBufferSize(int bufferSize) Set the buffer size.voidsetExternalVocabularies(Map referencedVocabualries) Set the map of referenced external vocabularies.voidsetForceStreamClose(boolean needForceStreamClose) Set the force stream close property.voidSet the InputStream to decode the fast infoset document.voidsetParseFragments(boolean parseFragments) Set the parse fragments property.voidsetRegisteredEncodingAlgorithms(Map algorithms) Sets the set of registered encoding algorithms.voidsetStringInterning(boolean stringInterning) Set the string interning property.voidSet the ParserVocabulary to be used for decoding.
-
Field Details
-
STRING_INTERNING_SYSTEM_PROPERTY
String interning system property.- See Also:
-
BUFFER_SIZE_SYSTEM_PROPERTY
Internal buffer size interning system property.- See Also:
-
_parseFragments
protected boolean _parseFragmentsTrue if can parse fragments. -
_needForceStreamClose
protected boolean _needForceStreamCloseTrue if needs to close underlying input stream. -
_notations
The list of Notation Information Items that are part of the Document Information Item. -
_unparsedEntities
The list of Unparsed Entity Information Items that are part of the Document Information Item. -
_registeredEncodingAlgorithms
The map of URIs to registered encoding algorithms. -
_v
The vocabulary used for decoding. -
_prefixTable
The prefix table of the vocabulary. -
_elementNameTable
The element name table of the vocabulary. -
_attributeNameTable
The attribute name table of the vocabulary. -
_characterContentChunkTable
The character content chunk table of the vocabulary. -
_attributeValueTable
The attribute value table of the vocabulary. -
_b
protected int _bThe current octet that is being read -
_terminate
protected boolean _terminateTrue if an information item is terminated. -
_doubleTerminate
protected boolean _doubleTerminateTrue if two information item are terminated in direct sequence. -
_addToTable
protected boolean _addToTableTrue if an entry is required to be added to a table -
_integer
protected int _integerThe vocabulary table index to an indexed non identifying string. -
_identifier
protected int _identifierThe vocabulary table index of identifying string or the identifier of an encoding algorithm or restricted alphabet. -
_bufferSize
protected int _bufferSizeThe size of the internal buffer. -
_octetBuffer
protected byte[] _octetBufferThe internal buffer used for decoding. -
_octetBufferStart
protected int _octetBufferStartA mark into the internal buffer used for decoding encoded algorithm or restricted alphabet data. -
_octetBufferOffset
protected int _octetBufferOffsetThe offset into the buffer to read the next byte. -
_octetBufferEnd
protected int _octetBufferEndThe end of the buffer. -
_octetBufferLength
protected int _octetBufferLengthThe length of some octets in the buffer that are to be read. -
_charBuffer
protected char[] _charBufferThe internal buffer of characters. -
_charBufferLength
protected int _charBufferLengthThe length of characters in the buffer of characters. -
_duplicateAttributeVerifier
Helper class that checks for duplicate attribute information items. -
NISTRING_STRING
protected static final int NISTRING_STRING- See Also:
-
NISTRING_INDEX
protected static final int NISTRING_INDEX- See Also:
-
NISTRING_ENCODING_ALGORITHM
protected static final int NISTRING_ENCODING_ALGORITHM- See Also:
-
NISTRING_EMPTY_STRING
protected static final int NISTRING_EMPTY_STRING- See Also:
-
_prefixIndex
protected int _prefixIndex -
_namespaceNameIndex
protected int _namespaceNameIndex
-
-
Constructor Details
-
Decoder
protected Decoder()Default constructor for the Decoder.
-
-
Method Details
-
setStringInterning
public void setStringInterning(boolean stringInterning) Set the string interning property.If the string interning property is set to true then
Stringobjects instantiated for [namespace name], [prefix] and [local name] infoset properties will be interned using the methodString.intern().- Specified by:
setStringInterningin interfaceFastInfosetParser- Parameters:
stringInterning- The string interning property.
-
getStringInterning
public boolean getStringInterning()Return the string interning property.- Specified by:
getStringInterningin interfaceFastInfosetParser- Returns:
- The string interning property.
-
setBufferSize
public void setBufferSize(int bufferSize) Set the buffer size.The size of the buffer for parsing is set using this method. Requests for sizes smaller then the current size will be ignored. Otherwise the buffer will be resized when the next parse is performed.
- Specified by:
setBufferSizein interfaceFastInfosetParser- Parameters:
bufferSize- The requested buffer size.
-
getBufferSize
public int getBufferSize()Get the buffer size.- Specified by:
getBufferSizein interfaceFastInfosetParser- Returns:
- The buffer size.
-
setRegisteredEncodingAlgorithms
Sets the set of registered encoding algorithms.- Specified by:
setRegisteredEncodingAlgorithmsin interfaceFastInfosetParser- Parameters:
algorithms- The set of registered algorithms.
-
getRegisteredEncodingAlgorithms
Gets the set of registered encoding algorithms.- Specified by:
getRegisteredEncodingAlgorithmsin interfaceFastInfosetParser- Returns:
- The set of registered algorithms.
-
setExternalVocabularies
Set the map of referenced external vocabularies.The map (but not the keys and values) be cloned.
- Specified by:
setExternalVocabulariesin interfaceFastInfosetParser- Parameters:
referencedVocabualries- the map of URI to vocabulary.
-
getExternalVocabularies
Get the map of referenced external vocabularies.- Specified by:
getExternalVocabulariesin interfaceFastInfosetParser- Returns:
- the map of URI to vocabulary.
-
setParseFragments
public void setParseFragments(boolean parseFragments) Set the parse fragments property.If the parse fragments property is set to true then fragments of an XML infoset may be parsed.
- Specified by:
setParseFragmentsin interfaceFastInfosetParser- Parameters:
parseFragments- The parse fragments property.
-
getParseFragments
public boolean getParseFragments()Return the parse fragments property.- Specified by:
getParseFragmentsin interfaceFastInfosetParser- Returns:
- The parse fragments property.
-
setForceStreamClose
public void setForceStreamClose(boolean needForceStreamClose) Set the force stream close property.If the force stream property is set to true then Parser's underlying InputStream will be closed.
- Specified by:
setForceStreamClosein interfaceFastInfosetParser- Parameters:
needForceStreamClose- The force stream close property.
-
getForceStreamClose
public boolean getForceStreamClose()Return the force stream close property.- Specified by:
getForceStreamClosein interfaceFastInfosetParser- Returns:
- The force stream close property.
-
reset
public void reset()Reset the decoder for reuse decoding another XML infoset. -
setVocabulary
Set the ParserVocabulary to be used for decoding.- Parameters:
v- the vocabulary to be used for decoding.
-
setInputStream
Set the InputStream to decode the fast infoset document.- Parameters:
s- the InputStream where the fast infoset document is decoded from.
-
decodeDII
- Throws:
FastInfosetExceptionIOException
-
decodeAdditionalData
- Throws:
FastInfosetExceptionIOException
-
decodeInitialVocabulary
- Throws:
FastInfosetExceptionIOException
-
decodeNotations
- Throws:
FastInfosetExceptionIOException
-
decodeUnparsedEntities
- Throws:
FastInfosetExceptionIOException
-
decodeCharacterEncodingScheme
- Throws:
FastInfosetExceptionIOException
-
decodeVersion
- Throws:
FastInfosetExceptionIOException
-
decodeEIIIndexMedium
- Throws:
FastInfosetExceptionIOException
-
decodeEIIIndexLarge
- Throws:
FastInfosetExceptionIOException
-
decodeLiteralQualifiedName
protected final QualifiedName decodeLiteralQualifiedName(int state, QualifiedName q) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeNonIdentifyingStringOnFirstBit
- Throws:
FastInfosetExceptionIOException
-
decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit
protected final void decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(int b) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit
protected final void decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(int b) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeIdentifyingNonEmptyStringOnFirstBit
protected final String decodeIdentifyingNonEmptyStringOnFirstBit(StringArray table) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix
protected final String decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(boolean namespaceNamePresent) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix
protected final String decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix(boolean namespaceNamePresent) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName
protected final String decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(boolean prefixPresent) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName
protected final String decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(boolean prefixPresent) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeNonEmptyOctetStringOnSecondBitAsUtf8String
protected final String decodeNonEmptyOctetStringOnSecondBitAsUtf8String() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
decodeNonEmptyOctetStringOnSecondBitAsUtf8CharArray
protected final void decodeNonEmptyOctetStringOnSecondBitAsUtf8CharArray() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
decodeNonEmptyOctetStringLengthOnSecondBit
protected final void decodeNonEmptyOctetStringLengthOnSecondBit() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
decodeIntegerIndexOnSecondBit
- Throws:
FastInfosetExceptionIOException
-
decodeHeader
- Throws:
FastInfosetExceptionIOException
-
decodeRestrictedAlphabetAsCharBuffer
protected final void decodeRestrictedAlphabetAsCharBuffer() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
decodeRestrictedAlphabetAsString
- Throws:
FastInfosetExceptionIOException
-
decodeRAOctetsAsString
protected final String decodeRAOctetsAsString(char[] restrictedAlphabet) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeFourBitAlphabetOctetsAsCharBuffer
protected final void decodeFourBitAlphabetOctetsAsCharBuffer(char[] restrictedAlphabet) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeAlphabetOctetsAsCharBuffer
protected final void decodeAlphabetOctetsAsCharBuffer(char[] restrictedAlphabet) throws FastInfosetException, IOException - Throws:
FastInfosetExceptionIOException
-
decodeUtf8StringAsCharBuffer
- Throws:
IOException
-
decodeUtf8StringAsCharBuffer
- Throws:
IOException
-
decodeUtf8StringAsString
- Throws:
IOException
-
decodeUtf16StringAsCharBuffer
- Throws:
IOException
-
decodeUtf16StringAsString
- Throws:
IOException
-
decodeUtf8StringIntoCharBuffer
- Throws:
IOException
-
decodeUtf8StringIntoCharBuffer
- Throws:
IOException
-
decodeUtf8NCNameIntoCharBuffer
- Throws:
IOException
-
createQualifiedNameString
-
createQualifiedNameString
-
read
- Throws:
IOException
-
closeIfRequired
- Throws:
IOException
-
peek
- Throws:
IOException
-
peek
- Throws:
IOException
-
peek2
- Throws:
IOException
-
_isFastInfosetDocument
- Throws:
IOException
-
isFastInfosetDocument
- Throws:
IOException
-