|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.util.CharArray
A CharArray is a utility class that represents a number of text characters. It is generally used as a buffer for text storage.
Associated with the CharArray is a char [] value called "data" which holds the data characters (starting from index 0) and the "length" variable specifies how many of those characters are considered valid (which may be less than the actual length of the data variable).
| Field Summary | |
char[] |
data
These are the data characters. |
int |
length
This denotes the number of valid characters in the data array. |
| Constructor Summary | |
CharArray()
|
|
| Method Summary | |
void |
append(char[] src,
int start,
int length)
Add characters to the end of the CharArray. |
void |
append(String src)
|
void |
copyFrom(char[] data,
int offset,
int length)
Set the data in the CharArray to be a copy of the data provided re-using the internal char array if possible. |
void |
copyFrom(String data)
Set the data in the CharArray to be a copy of the data in the string, re-using the internal char array if possible. |
void |
copyFrom(SubString data)
Set the data in the CharArray to be a copy of the data in the SubString, re-using the internal char array if possible. |
void |
ensureCapacity(int newCapacity)
This will ensure that the size of the "data" character array is at least newCapacity. |
Object |
getCopy()
Return a copy of this CharArray which has its own copy of the data. |
void |
insert(int where,
char[] src,
int start,
int length)
Insert characters into the CharArray. |
boolean |
makeSpace(int where,
int numcharacters)
This adds space to the CharArray at the specified index. |
String |
toString()
Return a String representation of this object. |
void |
write(int where,
char[] src,
int start,
int length)
This writes into the data at the specific location. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode |
| Field Detail |
public char[] data
public int length
| Constructor Detail |
public CharArray()
| Method Detail |
public Object getCopy()
getCopy in interface Copyable
public boolean makeSpace(int where,
int numcharacters)
public void write(int where,
char[] src,
int start,
int length)
public void insert(int where,
char[] src,
int start,
int length)
where - The index in this CharArray where the data will go.src - The source data characters.start - The start index in the source data.length - The number of characters to copy.
public void append(char[] src,
int start,
int length)
src - The source data characters.start - The start index in the source data.length - The number of characters to copy.public void append(String src)
public void ensureCapacity(int newCapacity)
newCapacity - The minimum size of the data array.public String toString()
Object
toString in class Objectpublic void copyFrom(String data)
public void copyFrom(char[] data,
int offset,
int length)
public void copyFrom(SubString data)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||