Package com.fasterxml.aalto.in
Class AttributeCollector
- java.lang.Object
-
- com.fasterxml.aalto.in.AttributeCollector
-
public final class AttributeCollector extends java.lang.ObjectObject used by the tokenizer to collect and store information about attributes, specifically, names and values.
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]_attrMapInt-based compact data structure that contains mapping from attribute names to attribute indexes in the main attribute name array.protected int_hashAreaSizeSize of hash area in_attrMap; generally at least 20% more than number of attributes (_attrCount).protected int_spillAreaEndPointer to int slot right after last spill entry, in_attrMaparray.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAttributeCollector(ReaderConfig cfg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char[]continueValue()byte[]decodeBinaryValue(int index, org.codehaus.stax2.typed.Base64Variant v, org.codehaus.stax2.ri.typed.CharArrayBase64Decoder dec, XmlScanner scanner)voiddecodeValue(int index, org.codehaus.stax2.typed.TypedValueDecoder dec)intdecodeValues(int index, org.codehaus.stax2.typed.TypedArrayDecoder dec, XmlScanner scanner)intfindIndex(java.lang.String nsUri, java.lang.String localName)intfinishLastValue(int endingOffset)Method called after all attribute entries have been parsed, and thus the end of the last value in the buffer is known.intfinishLastValue2()intgetCount()java.lang.StringgetErrorMsg()PNamegetName(int index)javax.xml.namespace.QNamegetQName(int index)java.lang.StringgetValue(int index)java.lang.StringgetValue(java.lang.String nsUri, java.lang.String localName)char[]startNewValue(PName attrName, int currOffset)Method called by the parser right after attribute name has been parsed, but before value has been parsed.char[]valueBufferFull()Method called by the owner, when the
-
-
-
Field Detail
-
_attrMap
protected int[] _attrMap
Int-based compact data structure that contains mapping from attribute names to attribute indexes in the main attribute name array.Data structure contains two separate areas; main hash area (with size
_hashAreaSize), and remaining spillover area that follows hash area up until (but not including)_spillAreaEndindex. Main hash area only contains indexes (index+1; 0 signifying empty slot) to actual attributes; spillover area has both hash and index for any spilled entry. Spilled entries are simply stored in order added, and need to be searched using linear search. In case of both primary hash hits and spills, eventual comparison with the local name needs to be done with actual name array.
-
_hashAreaSize
protected int _hashAreaSize
Size of hash area in_attrMap; generally at least 20% more than number of attributes (_attrCount).
-
_spillAreaEnd
protected int _spillAreaEnd
Pointer to int slot right after last spill entry, in_attrMaparray.
-
-
Constructor Detail
-
AttributeCollector
protected AttributeCollector(ReaderConfig cfg)
-
-
Method Detail
-
startNewValue
public char[] startNewValue(PName attrName, int currOffset)
Method called by the parser right after attribute name has been parsed, but before value has been parsed.- Returns:
- Underlying character buffer to use for storing attribute value characters
-
continueValue
public char[] continueValue()
-
finishLastValue
public final int finishLastValue(int endingOffset)
Method called after all attribute entries have been parsed, and thus the end of the last value in the buffer is known.- Returns:
- Number of attributes collected
-
finishLastValue2
public final int finishLastValue2()
-
valueBufferFull
public char[] valueBufferFull()
Method called by the owner, when the
-
getCount
public final int getCount()
-
getName
public final PName getName(int index)
-
getQName
public final javax.xml.namespace.QName getQName(int index)
-
getValue
public java.lang.String getValue(int index)
-
getValue
public java.lang.String getValue(java.lang.String nsUri, java.lang.String localName)
-
findIndex
public int findIndex(java.lang.String nsUri, java.lang.String localName)
-
getErrorMsg
public java.lang.String getErrorMsg()
-
decodeValue
public final void decodeValue(int index, org.codehaus.stax2.typed.TypedValueDecoder dec) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
decodeValues
public final int decodeValues(int index, org.codehaus.stax2.typed.TypedArrayDecoder dec, XmlScanner scanner) throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
decodeBinaryValue
public byte[] decodeBinaryValue(int index, org.codehaus.stax2.typed.Base64Variant v, org.codehaus.stax2.ri.typed.CharArrayBase64Decoder dec, XmlScanner scanner) throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
-