| java.lang.Object java.text.AttributedString
AttributedString | public class AttributedString (Code) | | An AttributedString holds text and related attribute information. It
may be used as the actual data storage in some cases where a text
reader wants to access attributed text through the AttributedCharacterIterator
interface.
See Also: AttributedCharacterIterator See Also: Annotation since: 1.2 |
Method Summary | |
public void | addAttribute(Attribute attribute, Object value) Adds an attribute to the entire string. | public void | addAttribute(Attribute attribute, Object value, int beginIndex, int endIndex) Adds an attribute to a subrange of the string.
Parameters: attribute - the attribute key Parameters: value - The value of the attribute. | public void | addAttributes(Map attributes, int beginIndex, int endIndex) Adds a set of attributes to a subrange of the string. | public AttributedCharacterIterator | getIterator() Creates an AttributedCharacterIterator instance that provides access to the entire contents of
this string. | public AttributedCharacterIterator | getIterator(Attribute[] attributes) Creates an AttributedCharacterIterator instance that provides access to
selected contents of this string. | public AttributedCharacterIterator | getIterator(Attribute[] attributes, int beginIndex, int endIndex) Creates an AttributedCharacterIterator instance that provides access to
selected contents of this string. | int | length() |
runArraySize | int runArraySize(Code) | | |
AttributedString | AttributedString(AttributedCharacterIterator[] iterators)(Code) | | Constructs an AttributedString instance with the given
AttributedCharacterIterators.
Parameters: iterators - AttributedCharacterIterators to constructAttributedString from. throws: NullPointerException - if iterators is null |
AttributedString | public AttributedString(String text)(Code) | | Constructs an AttributedString instance with the given text.
Parameters: text - The text for this attributed string. |
AttributedString | public AttributedString(String text, Map attributes)(Code) | | Constructs an AttributedString instance with the given text and attributes.
Parameters: text - The text for this attributed string. Parameters: attributes - The attributes that apply to the entire string. exception: IllegalArgumentException - if the text has length 0and the attributes parameter is not an empty Map (attributescannot be applied to a 0-length range). |
AttributedString | public AttributedString(AttributedCharacterIterator text)(Code) | | Constructs an AttributedString instance with the given attributed
text represented by AttributedCharacterIterator.
Parameters: text - The text for this attributed string. |
AttributedString | public AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex)(Code) | | Constructs an AttributedString instance with the subrange of
the given attributed text represented by
AttributedCharacterIterator. If the given range produces an
empty text, all attributes will be discarded. Note that any
attributes wrapped by an Annotation object are discarded for a
subrange of the original attribute range.
Parameters: text - The text for this attributed string. Parameters: beginIndex - Index of the first character of the range. Parameters: endIndex - Index of the character following the last characterof the range. exception: IllegalArgumentException - if the subrange given bybeginIndex and endIndex is out of the text range. See Also: java.text.Annotation |
AttributedString | public AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex, Attribute[] attributes)(Code) | | Constructs an AttributedString instance with the subrange of
the given attributed text represented by
AttributedCharacterIterator. Only attributes that match the
given attributes will be incorporated into the instance. If the
given range produces an empty text, all attributes will be
discarded. Note that any attributes wrapped by an Annotation
object are discarded for a subrange of the original attribute
range.
Parameters: text - The text for this attributed string. Parameters: beginIndex - Index of the first character of the range. Parameters: endIndex - Index of the character following the last characterof the range. Parameters: attributes - Specifies attributes to be extractedfrom the text. If null is specified, all available attributes willbe used. exception: IllegalArgumentException - if the subrange given bybeginIndex and endIndex is out of the text range. See Also: java.text.Annotation |
addAttribute | public void addAttribute(Attribute attribute, Object value)(Code) | | Adds an attribute to the entire string.
Parameters: attribute - the attribute key Parameters: value - the value of the attribute; may be null exception: IllegalArgumentException - if the AttributedString has length 0(attributes cannot be applied to a 0-length range). |
addAttribute | public void addAttribute(Attribute attribute, Object value, int beginIndex, int endIndex)(Code) | | Adds an attribute to a subrange of the string.
Parameters: attribute - the attribute key Parameters: value - The value of the attribute. May be null. Parameters: beginIndex - Index of the first character of the range. Parameters: endIndex - Index of the character following the last character of the range. exception: IllegalArgumentException - if beginIndex is less then 0, endIndex isgreater than the length of the string, or beginIndex and endIndex together don'tdefine a non-empty subrange of the string. |
addAttributes | public void addAttributes(Map attributes, int beginIndex, int endIndex)(Code) | | Adds a set of attributes to a subrange of the string.
Parameters: attributes - The attributes to be added to the string. Parameters: beginIndex - Index of the first character of the range. Parameters: endIndex - Index of the character following the lastcharacter of the range. exception: IllegalArgumentException - if beginIndex is less then0, endIndex is greater than the length of the string, orbeginIndex and endIndex together don't define a non-emptysubrange of the string and the attributes parameter is not anempty Map. |
getIterator | public AttributedCharacterIterator getIterator()(Code) | | Creates an AttributedCharacterIterator instance that provides access to the entire contents of
this string.
An iterator providing access to the text and its attributes. |
getIterator | public AttributedCharacterIterator getIterator(Attribute[] attributes)(Code) | | Creates an AttributedCharacterIterator instance that provides access to
selected contents of this string.
Information about attributes not listed in attributes that the
implementor may have need not be made accessible through the iterator.
If the list is null, all available attribute information should be made
accessible.
Parameters: attributes - a list of attributes that the client is interested in an iterator providing access to the text and its attributes |
getIterator | public AttributedCharacterIterator getIterator(Attribute[] attributes, int beginIndex, int endIndex)(Code) | | Creates an AttributedCharacterIterator instance that provides access to
selected contents of this string.
Information about attributes not listed in attributes that the
implementor may have need not be made accessible through the iterator.
If the list is null, all available attribute information should be made
accessible.
Parameters: attributes - a list of attributes that the client is interested in Parameters: beginIndex - the index of the first character Parameters: endIndex - the index of the character following the last character an iterator providing access to the text and its attributes exception: IllegalArgumentException - if beginIndex is less then 0,endIndex is greater than the length of the string, or beginIndex isgreater than endIndex. |
|
|