public class

ReplaceableString

extends Object
implements Replaceable
java.lang.Object
   ↳ sun.text.normalizer.ReplaceableString

Class Overview

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.

See Also

Summary

Public Constructors
ReplaceableString(String str)
Construct a new object with the given initial contents.
ReplaceableString(StringBuffer buf)
Construct a new object using buf for internal storage.
Public Methods
char charAt(int offset)
Return the character at the given position in this object.
void getChars(int srcStart, int srcLimit, char[] dst, int dstStart)
Copies characters from this object into the destination character array.
int length()
Return the number of characters contained in this object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sun.text.normalizer.Replaceable

Public Constructors

public ReplaceableString (String str)

Construct a new object with the given initial contents.

Parameters
str initial contents

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 object to be used as internal storage

Public Methods

public char charAt (int offset)

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

Parameters
offset offset into the contents, from 0 to length() - 1
Returns
  • 16-bit code unit of text at given offset

public void getChars (int srcStart, int srcLimit, char[] dst, int dstStart)

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 the beginning index to copy, inclusive; 0 <= start <= limit.
srcLimit the ending index to copy, exclusive; start <= limit <= length().
dst the destination array.
dstStart the start offset in the destination array.

public int length ()

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

Returns
  • number of 16-bit code units in text