AttributedCharacterIterator
allows iteration through both text and
related attribute information.
An attribute is a key/value pair, identified by the key. No two attributes on a given character can have the same key.
The values for an attribute are immutable, or must not be mutated by clients or storage. They are always passed by reference, and not cloned.
A run with respect to an attribute is a maximum text range for which:
null
for the entire range, or
null
value for the
entire range.
A run with respect to a set of attributes is a maximum text range for which this condition is met for each member attribute.
When getting a run with no explicit attributes specified (i.e.,
calling getRunStart()
and getRunLimit()
), any
contiguous text segments having the same attributes (the same set
of attribute/value pairs) are treated as separate runs if the
attributes have been given to those text segments separately.
The returned indexes are limited to the range of the iterator.
The returned attribute information is limited to runs that contain the current character.
Attribute keys are instances of AttributedCharacterIterator.
and its
subclasses, such as java.
.
AttributedCharacterIterator.Attribute
, java.desktop/java.awt.font.TextAttribute
, AttributedString
, Annotation
Modifier and Type | Class and Description |
---|---|
public static class | AttributedCharacterIterator.
Defines attribute keys that are used to identify text attributes. |
Modifier and Type | Method and Description |
---|---|
public Set | Returns: the keys of all attributesReturns the keys of all attributes defined on the iterator's text range. |
public Object | Returns: the value of the namedattribute or null the desired attribute attributeReturns the value of the named |
public Map | Returns: a map with the attributes defined on the current characterReturns a map with the attributes defined on the current character. |
public int | Returns: the index of the first character following the runReturns the index of the first character following the run with respect to all attributes containing the current character. |
public int | Returns: the index of the first character following the runthe desired attribute attributeReturns the index of the first character following the run
with respect to the given |
public int | Returns: the index of the first character following the runa set of the desired attributes attributes)Returns the index of the first character following the run
with respect to the given |
public int | Returns: the index of the first character of the runReturns the index of the first character of the run with respect to all attributes containing the current character. |
public int | Returns: the index of the first character of the runthe desired attribute. attributeReturns the index of the first character of the run
with respect to the given |
public int | Returns: the index of the first character of the runa set of the desired attributes. attributes)Returns the index of the first character of the run
with respect to the given |
getAllAttributeKeys | back to summary |
---|---|
public Set Returns the keys of all attributes defined on the iterator's text range. The set is empty if no attributes are defined.
|
getAttribute | back to summary |
---|---|
public Object getAttribute(AttributedCharacterIterator. Returns the value of the named
|
getAttributes | back to summary |
---|---|
public Map Returns a map with the attributes defined on the current character.
|
getRunLimit | back to summary |
---|---|
public int getRunLimit() Returns the index of the first character following the run with respect to all attributes containing the current character. Any contiguous text segments having the same attributes (the same set of attribute/value pairs) are treated as separate runs if the attributes have been given to those text segments separately.
|
getRunLimit | back to summary |
---|---|
public int getRunLimit(AttributedCharacterIterator. Returns the index of the first character following the run
with respect to the given
|
getRunLimit | back to summary |
---|---|
public int getRunLimit(Set<? extends AttributedCharacterIterator. Returns the index of the first character following the run
with respect to the given
|
getRunStart | back to summary |
---|---|
public int getRunStart() Returns the index of the first character of the run with respect to all attributes containing the current character. Any contiguous text segments having the same attributes (the same set of attribute/value pairs) are treated as separate runs if the attributes have been given to those text segments separately.
|
getRunStart | back to summary |
---|---|
public int getRunStart(AttributedCharacterIterator. Returns the index of the first character of the run
with respect to the given
|
getRunStart | back to summary |
---|---|
public int getRunStart(Set<? extends AttributedCharacterIterator. Returns the index of the first character of the run
with respect to the given
|
AttributedCharacterIterator
and AttributedString
.
AttributedCharacterIterator
, AttributedString
Modifier and Type | Field and Description |
---|---|
public static final AttributedCharacterIterator. | INPUT_METHOD_SEGMENT
Attribute key for input method segments. |
private static final Map | |
public static final AttributedCharacterIterator. | LANGUAGE
Attribute key for the language of some text. |
private String | name
The name of this |
public static final AttributedCharacterIterator. | READING
Attribute key for the reading of some text. |
private static final long |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public final boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Compares two objects for equality. |
protected String | |
public final int | |
protected Object | Returns: the resolvedAttribute objectResolves instances being deserialized to the predefined constants. |
public String |
INPUT_METHOD_SEGMENT | back to summary |
---|---|
public static final AttributedCharacterIterator. Attribute key for input method segments. Input methods often break up text into segments, which usually correspond to words. Values are instances of
|
instanceMap | back to summary |
---|---|
private static final Map<String, AttributedCharacterIterator. |
LANGUAGE | back to summary |
---|---|
public static final AttributedCharacterIterator. Attribute key for the language of some text. Values are instances of
|
name | back to summary |
---|---|
private String name The name of this |
READING | back to summary |
---|---|
public static final AttributedCharacterIterator. Attribute key for the reading of some text. In languages where the written form and the pronunciation of a word are only loosely related (such as Japanese), it is often necessary to store the reading (pronunciation) along with the written form. Values are instances of
|
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID
|
Attribute | back to summary |
---|---|
protected Attribute(String name) Constructs an
|
equals | back to summary |
---|---|
public final boolean equals(Object obj) Overrides java. Compares two objects for equality. This version only returns true
for
|
getName | back to summary |
---|---|
protected String getName() Returns the name of the attribute.
|
hashCode | back to summary |
---|---|
public final int hashCode() Overrides java. Returns a hash code value for the object. This version is identical to
the one in
|
readResolve | back to summary |
---|---|
protected Object readResolve() throws InvalidObjectException Resolves instances being deserialized to the predefined constants.
|
toString | back to summary |
---|---|
public String toString() Overrides java. Returns a string representation of the object. This version returns the
concatenation of class name,
|