public class EncodingAlgorithmAttributesImpl extends java.lang.Object implements EncodingAlgorithmAttributes
EncodingAlgorithmAttributes
interface.
This class provides a default implementation of the SAX2
EncodingAlgorithmAttributes
interface, with the
addition of manipulators so that the list can be modified or
reused.
There are two typical uses of this class:
startElement
event; orModifier and Type | Field and Description |
---|---|
private java.lang.Object[] |
_algorithmData |
private int[] |
_algorithmIds |
private java.lang.String[] |
_alphabets |
private java.lang.String[] |
_data |
private int |
_length |
private java.util.Map |
_registeredEncodingAlgorithms |
private boolean[] |
_toIndex |
private static int |
ALGORITHMURI_OFFSET |
private static int |
DEFAULT_CAPACITY |
private static int |
LOCALNAME_OFFSET |
private static int |
QNAME_OFFSET |
private static int |
SIZE |
private static int |
TYPE_OFFSET |
private static int |
URI_OFFSET |
private static int |
VALUE_OFFSET |
Constructor and Description |
---|
EncodingAlgorithmAttributesImpl()
Construct a new, empty EncodingAlgorithmAttributesImpl object.
|
EncodingAlgorithmAttributesImpl(org.xml.sax.Attributes attributes)
Copy an existing Attributes object.
|
EncodingAlgorithmAttributesImpl(java.util.Map registeredEncodingAlgorithms,
org.xml.sax.Attributes attributes)
Use registered encoding algorithms and copy an existing Attributes object.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String URI,
java.lang.String localName,
java.lang.String qName,
java.lang.String type,
java.lang.String value)
Add an attribute to the end of the list.
|
void |
addAttribute(java.lang.String URI,
java.lang.String localName,
java.lang.String qName,
java.lang.String type,
java.lang.String value,
boolean index,
java.lang.String alphabet)
Add an attribute to the end of the list.
|
void |
addAttributeWithAlgorithmData(java.lang.String URI,
java.lang.String localName,
java.lang.String qName,
java.lang.String algorithmURI,
int algorithmID,
java.lang.Object algorithmData)
Add an attribute with algorithm data to the end of the list.
|
void |
addAttributeWithBuiltInAlgorithmData(java.lang.String URI,
java.lang.String localName,
java.lang.String qName,
int builtInAlgorithmID,
java.lang.Object algorithmData)
Add an attribute with built in algorithm data to the end of the list.
|
void |
clear()
Clear the attribute list for reuse.
|
private java.lang.StringBuffer |
convertEncodingAlgorithmDataToString(int identifier,
java.lang.String URI,
java.lang.Object data) |
java.lang.Object |
getAlgorithmData(int index)
Return the data of the encoding algorithm.
|
int |
getAlgorithmIndex(int index)
Return the index of the encoding algorithm.
|
java.lang.String |
getAlgorithmURI(int index)
Return the URI of the encoding algorithm.
|
java.lang.String |
getAlpababet(int index)
Return the alphabet associated with the attribute value.
|
int |
getIndex(java.lang.String qName) |
int |
getIndex(java.lang.String uri,
java.lang.String localName) |
int |
getLength() |
java.lang.String |
getLocalName(int index) |
java.lang.String |
getQName(int index) |
boolean |
getToIndex(int index)
Return the whether the attribute value should be indexed or not.
|
java.lang.String |
getType(int index) |
java.lang.String |
getType(java.lang.String qName) |
java.lang.String |
getType(java.lang.String uri,
java.lang.String localName) |
java.lang.String |
getURI(int index) |
java.lang.String |
getValue(int index) |
java.lang.String |
getValue(java.lang.String qName) |
java.lang.String |
getValue(java.lang.String uri,
java.lang.String localName) |
private java.lang.String |
replaceNull(java.lang.String s) |
void |
replaceWithAttributeAlgorithmData(int index,
java.lang.String algorithmURI,
int algorithmID,
java.lang.Object algorithmData)
Replace an attribute value with algorithm data.
|
private void |
resize() |
private void |
resizeNoCopy() |
void |
setAttributes(org.xml.sax.Attributes atts)
Copy an entire Attributes object.
|
void |
setAttributes(EncodingAlgorithmAttributes atts)
Copy an entire EncodingAlgorithmAttributes object.
|
private static final int DEFAULT_CAPACITY
private static final int URI_OFFSET
private static final int LOCALNAME_OFFSET
private static final int QNAME_OFFSET
private static final int TYPE_OFFSET
private static final int VALUE_OFFSET
private static final int ALGORITHMURI_OFFSET
private static final int SIZE
private java.util.Map _registeredEncodingAlgorithms
private int _length
private java.lang.String[] _data
private int[] _algorithmIds
private java.lang.Object[] _algorithmData
private java.lang.String[] _alphabets
private boolean[] _toIndex
public EncodingAlgorithmAttributesImpl()
public EncodingAlgorithmAttributesImpl(org.xml.sax.Attributes attributes)
This constructor is especially useful inside a
startElement
event.
attributes
- The existing Attributes object.public EncodingAlgorithmAttributesImpl(java.util.Map registeredEncodingAlgorithms, org.xml.sax.Attributes attributes)
This constructor is especially useful inside a
startElement
event.
registeredEncodingAlgorithms
- The registeredEncodingAlgorithms encoding algorithms.attributes
- The existing Attributes object.public final void clear()
public void addAttribute(java.lang.String URI, java.lang.String localName, java.lang.String qName, java.lang.String type, java.lang.String value)
For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility of the application.
URI
- The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.localName
- The local name, or the empty string if
Namespace processing is not being performed.qName
- The qualified (prefixed) name, or the empty string
if qualified names are not available.type
- The attribute type as a string.value
- The attribute value.public void addAttribute(java.lang.String URI, java.lang.String localName, java.lang.String qName, java.lang.String type, java.lang.String value, boolean index, java.lang.String alphabet)
For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility of the application.
URI
- The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.localName
- The local name, or the empty string if
Namespace processing is not being performed.qName
- The qualified (prefixed) name, or the empty string
if qualified names are not available.type
- The attribute type as a string.value
- The attribute value.index
- True if attribute should be indexed.alphabet
- The alphabet associated with the attribute value,
may be null if there is no associated alphabet.public void addAttributeWithBuiltInAlgorithmData(java.lang.String URI, java.lang.String localName, java.lang.String qName, int builtInAlgorithmID, java.lang.Object algorithmData)
For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility of the application.
URI
- The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.localName
- The local name, or the empty string if
Namespace processing is not being performed.qName
- The qualified (prefixed) name, or the empty string
if qualified names are not available.builtInAlgorithmID
- The built in algorithm ID.algorithmData
- The built in algorithm data.public void addAttributeWithAlgorithmData(java.lang.String URI, java.lang.String localName, java.lang.String qName, java.lang.String algorithmURI, int algorithmID, java.lang.Object algorithmData)
For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility of the application.
URI
- The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.localName
- The local name, or the empty string if
Namespace processing is not being performed.qName
- The qualified (prefixed) name, or the empty string
if qualified names are not available.algorithmURI
- The algorithm URI, or null if a built in algorithmalgorithmID
- The algorithm ID.algorithmData
- The algorithm data.public void replaceWithAttributeAlgorithmData(int index, java.lang.String algorithmURI, int algorithmID, java.lang.Object algorithmData)
For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility of the application.
index
- The index of the attribute whose value is to be replacedalgorithmURI
- The algorithm URI, or null if a built in algorithmalgorithmID
- The algorithm ID.algorithmData
- The algorithm data.public void setAttributes(org.xml.sax.Attributes atts)
atts
- The attributes to copy.public void setAttributes(EncodingAlgorithmAttributes atts)
atts
- The attributes to copy.public final int getLength()
getLength
in interface org.xml.sax.Attributes
public final java.lang.String getLocalName(int index)
getLocalName
in interface org.xml.sax.Attributes
public final java.lang.String getQName(int index)
getQName
in interface org.xml.sax.Attributes
public final java.lang.String getType(int index)
getType
in interface org.xml.sax.Attributes
public final java.lang.String getURI(int index)
getURI
in interface org.xml.sax.Attributes
public final java.lang.String getValue(int index)
getValue
in interface org.xml.sax.Attributes
public final int getIndex(java.lang.String qName)
getIndex
in interface org.xml.sax.Attributes
public final java.lang.String getType(java.lang.String qName)
getType
in interface org.xml.sax.Attributes
public final java.lang.String getValue(java.lang.String qName)
getValue
in interface org.xml.sax.Attributes
public final int getIndex(java.lang.String uri, java.lang.String localName)
getIndex
in interface org.xml.sax.Attributes
public final java.lang.String getType(java.lang.String uri, java.lang.String localName)
getType
in interface org.xml.sax.Attributes
public final java.lang.String getValue(java.lang.String uri, java.lang.String localName)
getValue
in interface org.xml.sax.Attributes
public final java.lang.String getAlgorithmURI(int index)
EncodingAlgorithmAttributes
If the algorithm data corresponds to a built-in encoding algorithm then the null is returned.
If the algorithm data corresponds to an application-defined encoding algorithm then the URI of the algorithm is returned.
If EncodingAlgorithmAttributes.getAlgorithmData(int)
returns null then the result of
this method is undefined.
getAlgorithmURI
in interface EncodingAlgorithmAttributes
index
- The attribute index (zero-based).public final int getAlgorithmIndex(int index)
EncodingAlgorithmAttributes
If EncodingAlgorithmAttributes.getAlgorithmData(int)
returns null then the result of
this method is undefined.
getAlgorithmIndex
in interface EncodingAlgorithmAttributes
index
- The attribute index (zero-based).EncodingAlgorithmIndexes
public final java.lang.Object getAlgorithmData(int index)
EncodingAlgorithmAttributes
If the algorithm data corresponds to a built-in encoding algorithm then an Object corresponding to the Java primitive type is returned.
If the algorithm data corresponds to an application-defined encoding
algorithm then an Object that is an instance of byte[]
is returned if there is no EncodingAlgorithm registered for the
application-defined encoding algorithm URI. Otherwise, an Object produced
from the registeredEncodingAlgorithm is returned.
If there no encoding algorithm data associated an attribute then
null
is returned.
getAlgorithmData
in interface EncodingAlgorithmAttributes
index
- The attribute index (zero-based).public final java.lang.String getAlpababet(int index)
EncodingAlgorithmAttributes
getAlpababet
in interface EncodingAlgorithmAttributes
index
- The attribute index (zero-based).public final boolean getToIndex(int index)
EncodingAlgorithmAttributes
getToIndex
in interface EncodingAlgorithmAttributes
index
- The attribute index (zero-based).private final java.lang.String replaceNull(java.lang.String s)
private final void resizeNoCopy()
private final void resize()
private final java.lang.StringBuffer convertEncodingAlgorithmDataToString(int identifier, java.lang.String URI, java.lang.Object data) throws FastInfosetException, java.io.IOException
FastInfosetException
java.io.IOException