public interface AttributedCharacterIterator extends CharacterIterator
AttributedCharacterIterator
允许通过文字和相关的属性信息迭代。
属性是一个键/值对,由键确定。在一个给定的字符上没有两个属性可以有相同的键。
属性的值是不可变的,也不能由客户端或存储发生突变。他们总是通过参考,而不是克隆。
对于一个属性的运行是一个最大的文本范围:
null
的整个范围,或null
。对于一组属性的运行,是为每个成员属性满足此条件的最大文本范围。
当获得一个运行没有显式指定的属性(例如,调用getRunStart()
和getRunLimit()
),任何连续的文本段具有相同的属性(同一组属性/值对)作为独立运行,如果属性已经分别给出这些文本段。
返回的索引仅限于迭代器的范围。
返回的属性信息仅限于包含当前字符的运行。
属性关键字是AttributedCharacterIterator.Attribute
及其子类的实例,如TextAttribute
。
AttributedCharacterIterator.Attribute
,
TextAttribute
,
AttributedString
,
Annotation
Modifier and Type | Interface and Description |
---|---|
static class |
AttributedCharacterIterator.Attribute
定义用于识别文本属性的属性键。
|
DONE
Modifier and Type | Method and Description |
---|---|
Set<AttributedCharacterIterator.Attribute> |
getAllAttributeKeys()
返回在迭代器的文本范围中定义的所有属性的键。
|
Object |
getAttribute(AttributedCharacterIterator.Attribute attribute)
返回指定的字符
attribute 电流值。
|
Map<AttributedCharacterIterator.Attribute,Object> |
getAttributes()
返回当前字符上定义的属性的Map。
|
int |
getRunLimit()
返回相对于所有包含当前字符的所有属性的运行后的第一个字符的索引。
|
int |
getRunLimit(AttributedCharacterIterator.Attribute attribute)
返回第一个字符的索引以下给定
attribute 包含当前字符的运行。
|
int |
getRunLimit(Set<? extends AttributedCharacterIterator.Attribute> attributes)
返回第一个字符的索引以下给定
attributes 包含当前字符的运行。
|
int |
getRunStart()
返回运行包含当前字符的所有属性的运行的第一个字符的索引。
|
int |
getRunStart(AttributedCharacterIterator.Attribute attribute)
返回与给定
attribute 包含当前字符运行的第一个字符的索引。
|
int |
getRunStart(Set<? extends AttributedCharacterIterator.Attribute> attributes)
返回与给定
attributes 包含当前字符运行的第一个字符的索引。
|
clone, current, first, getBeginIndex, getEndIndex, getIndex, last, next, previous, setIndex
int getRunStart()
任何连续的文本段具有相同的属性(相同的属性/值对)被视为单独运行,如果属性已被分别给予这些文本段。
int getRunStart(AttributedCharacterIterator.Attribute attribute)
attribute
包含当前字符运行的第一个字符的索引。
attribute
-所需的属性。
int getRunStart(Set<? extends AttributedCharacterIterator.Attribute> attributes)
attributes
包含当前字符运行的第一个字符的索引。
attributes
-一组所需的属性。
int getRunLimit()
任何连续的文本段具有相同的属性(相同的属性/值对)被视为单独运行,如果属性已被分别给予这些文本段。
int getRunLimit(AttributedCharacterIterator.Attribute attribute)
attribute
包含当前字符的运行。
attribute
-所需的属性
int getRunLimit(Set<? extends AttributedCharacterIterator.Attribute> attributes)
attributes
包含当前字符的运行。
attributes
-一组所需的属性
Map<AttributedCharacterIterator.Attribute,Object> getAttributes()
Object getAttribute(AttributedCharacterIterator.Attribute attribute)
attribute
电流值。返回
null
如果
attribute
未定义。
attribute
-所需的属性
attribute
或
null
价值
Set<AttributedCharacterIterator.Attribute> getAllAttributeKeys()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.