APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.icu.text

public Class ReplaceableString

extends Object
implements Replaceable
Class Inheritance
All Implemented Interfaces
jdk.internal.icu.text.Replaceable

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.

Copyright © IBM Corporation 1999. All rights reserved.

Author
Alan Liu
ICU Status
Stable since ICU 2.0.
See Also
Replaceable

Field Summary

Modifier and TypeField and Description
private StringBuffer

Constructor Summary

AccessConstructor 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 buf for internal storage.

Method Summary

Modifier and TypeMethod and Description
public char
charAt(int
offset into the contents, from 0 to length() - 1
offset
)

Implements jdk.internal.icu.text.Replaceable.charAt.

Return the character at the given position in this object.

public void
getChars(int
the beginning index to copy, inclusive; 0 <= start <= limit.
srcStart
,
int
the ending index to copy, exclusive; start <= limit <= length().
srcLimit
,
char[]
the destination array.
dst
,
int
the start offset in the destination array.
dstStart
)

Implements jdk.internal.icu.text.Replaceable.getChars.

Copies characters from this object into the destination character array.

public int
length()

Implements jdk.internal.icu.text.Replaceable.length.

Return the number of characters contained in this object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private StringBuffer buf

Constructor Detail

ReplaceableStringback to summary
public ReplaceableString(String str)

Construct a new object with the given initial contents.

Parameters
str:String

initial contents

ICU Status
Stable since ICU 2.0.
ReplaceableStringback to summary
public ReplaceableString(StringBuffer buf)

Construct a new object using buf for internal storage. The contents of buf at the time of construction are used as the initial contents.

Note

Modifications to buf will modify this object, and vice versa.

Parameters
buf:StringBuffer

object to be used as internal storage

ICU Status
Stable since ICU 2.0.

Method Detail

charAtback to summary
public char charAt(int offset)

Implements jdk.internal.icu.text.Replaceable.charAt.

Return the character at the given position in this object. Replaceable API.

Parameters
offset:int

offset into the contents, from 0 to length() - 1

ICU Status
Stable since ICU 2.0.
getCharsback to summary
public void getChars(int srcStart, int srcLimit, char[] dst, int dstStart)

Implements jdk.internal.icu.text.Replaceable.getChars.

Copies characters from this object into the destination character array. The first character to be copied is at index srcStart; the last character to be copied is at index srcLimit-1 (thus the total number of characters to be copied is srcLimit-srcStart). The characters are copied into the subarray of dst starting at index dstStart and ending at index dstStart + (srcLimit-srcStart) - 1.

Parameters
srcStart:int

the beginning index to copy, inclusive; 0 <= start <= limit.

srcLimit:int

the ending index to copy, exclusive; start <= limit <= length().

dst:char[]

the destination array.

dstStart:int

the start offset in the destination array.

ICU Status
Stable since ICU 2.0.
lengthback to summary
public int length()

Implements jdk.internal.icu.text.Replaceable.length.

Return the number of characters contained in this object. Replaceable API.

ICU Status
Stable since ICU 2.0.