public class EncodingAlgorithmAttributesImpl extends 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; orConstructor and Description |
---|
EncodingAlgorithmAttributesImpl()
Construct a new, empty EncodingAlgorithmAttributesImpl object.
|
EncodingAlgorithmAttributesImpl(Attributes attributes)
Copy an existing Attributes object.
|
EncodingAlgorithmAttributesImpl(Map registeredEncodingAlgorithms,
Attributes attributes)
Use registered encoding algorithms and copy an existing Attributes object.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String URI,
String localName,
String qName,
String type,
String value)
Add an attribute to the end of the list.
|
void |
addAttribute(String URI,
String localName,
String qName,
String type,
String value,
boolean index,
String alphabet)
Add an attribute to the end of the list.
|
void |
addAttributeWithAlgorithmData(String URI,
String localName,
String qName,
String algorithmURI,
int algorithmID,
Object algorithmData)
Add an attribute with algorithm data to the end of the list.
|
void |
addAttributeWithBuiltInAlgorithmData(String URI,
String localName,
String qName,
int builtInAlgorithmID,
Object algorithmData)
Add an attribute with built in algorithm data to the end of the list.
|
void |
clear()
Clear the attribute list for reuse.
|
Object |
getAlgorithmData(int index)
Return the data of the encoding algorithm.
|
int |
getAlgorithmIndex(int index)
Return the index of the encoding algorithm.
|
String |
getAlgorithmURI(int index)
Return the URI of the encoding algorithm.
|
String |
getAlpababet(int index)
Return the alphabet associated with the attribute value.
|
int |
getIndex(String qName) |
int |
getIndex(String uri,
String localName) |
int |
getLength() |
String |
getLocalName(int index) |
String |
getQName(int index) |
boolean |
getToIndex(int index)
Return the whether the attribute value should be indexed or not.
|
String |
getType(int index) |
String |
getType(String qName) |
String |
getType(String uri,
String localName) |
String |
getURI(int index) |
String |
getValue(int index) |
String |
getValue(String qName) |
String |
getValue(String uri,
String localName) |
void |
replaceWithAttributeAlgorithmData(int index,
String algorithmURI,
int algorithmID,
Object algorithmData)
Replace an attribute value with algorithm data.
|
void |
setAttributes(Attributes atts)
Copy an entire Attributes object.
|
void |
setAttributes(EncodingAlgorithmAttributes atts)
Copy an entire EncodingAlgorithmAttributes object.
|
public EncodingAlgorithmAttributesImpl()
public EncodingAlgorithmAttributesImpl(Attributes attributes)
This constructor is especially useful inside a
startElement
event.
attributes
- The existing Attributes object.public EncodingAlgorithmAttributesImpl(Map registeredEncodingAlgorithms, 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(String URI, String localName, String qName, String type, 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(String URI, String localName, String qName, String type, String value, boolean index, 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(String URI, String localName, String qName, int builtInAlgorithmID, 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(String URI, String localName, String qName, String algorithmURI, int algorithmID, 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, String algorithmURI, int algorithmID, 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(Attributes atts)
atts
- The attributes to copy.public void setAttributes(EncodingAlgorithmAttributes atts)
atts
- The attributes to copy.public final int getLength()
getLength
in interface Attributes
public final String getLocalName(int index)
getLocalName
in interface Attributes
public final String getQName(int index)
getQName
in interface Attributes
public final String getType(int index)
getType
in interface Attributes
public final String getURI(int index)
getURI
in interface Attributes
public final String getValue(int index)
getValue
in interface Attributes
public final int getIndex(String qName)
getIndex
in interface Attributes
public final String getType(String qName)
getType
in interface Attributes
public final String getValue(String qName)
getValue
in interface Attributes
public final int getIndex(String uri, String localName)
getIndex
in interface Attributes
public final String getType(String uri, String localName)
getType
in interface Attributes
public final String getValue(String uri, String localName)
getValue
in interface Attributes
public final 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 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 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).Copyright © 2017 Oracle Corpration. All Rights Reserved.