ReplaceableString is an adapter class that implements the
Replaceable API around an ordinary StringBuffer.Note
This class does not support attributes and is not
intended for general use. Most clients will need to implement
Replaceable in their text representation class.
Replaceable
| Modifier and Type | Field and Description |
|---|---|
| private StringBuffer |
| Access | Constructor and Description |
|---|---|
| public | ReplaceableString(String
initial contents str)Construct a new object with the given initial contents. |
| public | ReplaceableString(StringBuffer
object to be used as internal storage buf)Construct a new object using |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: 32-bit code point of text at given offsetan integer between 0 and offset)length()-1
inclusiveImplements com. |
| public char | charAt(int
offset into the contents, from 0 to
offset)length() - 1Implements com. |
| public void | copy(int
the beginning index, inclusive; start, int 0 <= start <=
limit.the ending index, exclusive; limit, int start <= limit <=
length().the destination index. The characters from
dest)start..limit-1 will be copied to dest.
Implementations of this method may assume that dest <= start ||
dest >= limit.Implements com. |
| public void | getChars(int
the beginning index to copy, inclusive; srcStart, int 0
<= start <= limit.the ending index to copy, exclusive;
srcLimit, char[] start <= limit <= length().the destination array. dst, int the start offset in the destination array. dstStart)Implements com. |
| public boolean | |
| public int | length()
Implements com. |
| public void | replace(int
the beginning index, inclusive; start, int 0 <= start
<= limit.the ending index, exclusive; limit, String start <= limit
<= length().new text to replace characters text)start to
limit - 1Implements com. |
| public void | replace(int
the beginning index, inclusive; start, int 0 <= start
<= limit.the ending index, exclusive; limit, char[] start <= limit
<= length().the text to replace characters chars, int start
to limit - 1the beginning index into charsStart, int chars,
inclusive; 0 <= start <= limit.the number of characters of charsLen)chars.Implements com. |
| public String | |
| public String | Returns: string contents of this objectOverrides java. String.
|
| buf | back to summary |
|---|---|
| private StringBuffer buf | |
| ReplaceableString | back to summary |
|---|---|
| public ReplaceableString(String str) Construct a new object with the given initial contents. | |
| ReplaceableString | back to summary |
|---|---|
| public ReplaceableString(StringBuffer buf) Construct a new object using Note Modifications to
| |
| ReplaceableString | back to summary |
|---|---|
| public ReplaceableString() Construct a new empty object.
| |
| char32At | back to summary |
|---|---|
| public int char32At(int offset) Implements com. Return the 32-bit code point at the given 16-bit offset into the text. This assumes the text is stored as 16-bit code units with surrogate pairs intermixed. If the offset of a leading or trailing code unit of a surrogate pair is given, return the code point of the surrogate pair. | |
| charAt | back to summary |
|---|---|
| public char charAt(int offset) Implements com. Return the character at the given position in this object.
| |
| copy | back to summary |
|---|---|
| public void copy(int start, int limit, int dest) Implements com. Copy a substring of this object, retaining attribute (out-of-band) information. This method is used to duplicate or reorder substrings. The destination index must not overlap the source range.
| |
| getChars | back to summary |
|---|---|
| public void getChars(int srcStart, int srcLimit, char[] dst, int dstStart) Implements com. Copies characters from this object into the destination
character array. The first character to be copied is at index
| |
| hasMetaData | back to summary |
|---|---|
| public boolean hasMetaData() Implements com. Implements Replaceable
| |
| length | back to summary |
|---|---|
| public int length() Implements com. Return the number of characters contained in this object.
| |
| replace | back to summary |
|---|---|
| public void replace(int start, int limit, String text) Implements com. Replace zero or more characters with new characters.
| |
| replace | back to summary |
|---|---|
| public void replace(int start, int limit, char[] chars, int charsStart, int charsLen) Implements com. Replace a substring of this object with the given text.
| |
| substring | back to summary |
|---|---|
| public String substring(int start, int limit) Return a substring of the given string.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Return the contents of this object as a | |