public final class AttributeCollector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
_allAttrValues
Concatenated String that contains all the attribute values
for the element.
|
private int |
_attrCount
Number of attributes currently held by this collector.
|
protected int[] |
_attrMap
Int-based compact data structure that contains mapping from
attribute names to attribute indexes in the main attribute name array.
|
(package private) ReaderConfig |
_config |
private java.lang.String |
_errorMsg
For some errors, we'll have to temporarily store error message,
to be thrown at a later point.
|
protected int |
_hashAreaSize
Size of hash area in
_attrMap ; generally at least 20%
more than number of attributes (_attrCount ). |
private PName[] |
_names |
private boolean |
_needToResetValues
Flag used to indicate that all attribute values for an element
have been parsed, and that next call to
startNewValue
should reset the value structures |
protected int |
_spillAreaEnd
Pointer to int slot right after last spill entry, in
_attrMap array. |
private char[] |
_valueBuffer
Consequtive character array, in which attribute values are
concatenated in
|
private int[] |
_valueOffsets
Array that contains ending offsets of the values in the shared
buffer.
|
private static int |
DEFAULT_BUFFER_LENGTH
The default length of the value buffer is also chosen more
to minimize overhead than to eliminate all need for resizing.
|
private static int |
DEFAULT_ENTRY_COUNT
Let's guess that most of the time there won't be more than
12 attributes.
|
private static int |
INT_SPACE |
Modifier | Constructor and Description |
---|---|
protected |
AttributeCollector(ReaderConfig cfg) |
Modifier and Type | Method and Description |
---|---|
private boolean |
checkExpand(org.codehaus.stax2.typed.TypedArrayDecoder tad)
Internal method used to see if we can expand the buffer that
the array decoder has.
|
char[] |
continueValue() |
byte[] |
decodeBinaryValue(int index,
org.codehaus.stax2.typed.Base64Variant v,
org.codehaus.stax2.ri.typed.CharArrayBase64Decoder dec,
XmlScanner scanner) |
void |
decodeValue(int index,
org.codehaus.stax2.typed.TypedValueDecoder dec) |
int |
decodeValues(int index,
org.codehaus.stax2.typed.TypedArrayDecoder dec,
XmlScanner scanner) |
private int |
decodeValues(org.codehaus.stax2.typed.TypedArrayDecoder dec,
char[] buf,
int ptr,
int end,
XmlScanner scanner) |
int |
findIndex(java.lang.String nsUri,
java.lang.String localName) |
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.
|
int |
finishLastValue2() |
int |
getCount() |
java.lang.String |
getErrorMsg() |
PName |
getName(int index) |
javax.xml.namespace.QName |
getQName(int index) |
java.lang.String |
getValue(int index) |
java.lang.String |
getValue(java.lang.String nsUri,
java.lang.String localName) |
private static boolean |
isSpace(char c) |
private void |
noteDupAttr(int ix1,
int ix2) |
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
|
private static final int INT_SPACE
private static final int DEFAULT_ENTRY_COUNT
private static final int DEFAULT_BUFFER_LENGTH
final ReaderConfig _config
private int _attrCount
private PName[] _names
private char[] _valueBuffer
protected int[] _attrMap
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)
_spillAreaEnd
index.
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.
protected int _hashAreaSize
_attrMap
; generally at least 20%
more than number of attributes (_attrCount
).protected int _spillAreaEnd
_attrMap
array.private int[] _valueOffsets
private boolean _needToResetValues
startNewValue
should reset the value structuresprivate java.lang.String _errorMsg
private java.lang.String _allAttrValues
protected AttributeCollector(ReaderConfig cfg)
public char[] startNewValue(PName attrName, int currOffset)
public char[] continueValue()
public final int finishLastValue(int endingOffset)
public final int finishLastValue2()
public char[] valueBufferFull()
public final int getCount()
public final PName getName(int index)
public final javax.xml.namespace.QName getQName(int index)
public java.lang.String getValue(int index)
public java.lang.String getValue(java.lang.String nsUri, java.lang.String localName)
public int findIndex(java.lang.String nsUri, java.lang.String localName)
public java.lang.String getErrorMsg()
public final void decodeValue(int index, org.codehaus.stax2.typed.TypedValueDecoder dec) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public final int decodeValues(int index, org.codehaus.stax2.typed.TypedArrayDecoder dec, XmlScanner scanner) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private final int decodeValues(org.codehaus.stax2.typed.TypedArrayDecoder dec, char[] buf, int ptr, int end, XmlScanner scanner) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
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
javax.xml.stream.XMLStreamException
private static final boolean isSpace(char c)
private final boolean checkExpand(org.codehaus.stax2.typed.TypedArrayDecoder tad)
private void noteDupAttr(int ix1, int ix2)