|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.module.sitemesh.util.CharArray
public class CharArray
A leaner, meaner version of StringBuffer.
It provides basic functionality to handle dynamically-growing char arrays as quickly as possible. This class is not threadsafe.
Field Summary | |
---|---|
(package private) char[] |
buffer
|
(package private) int |
size
|
(package private) int |
subStrLen
|
(package private) int |
subStrStart
|
Constructor Summary | |
---|---|
CharArray(int size)
Constructs a CharArray that is initialized to the specified size. |
Method Summary | |
---|---|
CharArray |
append(char c)
Appends a single character to the end of the character array. |
CharArray |
append(char[] chars)
Appends the supplied characters to the end of the array. |
private CharArray |
append(char[] chars,
int length)
|
CharArray |
append(CharArray chars)
Appends an existing CharArray on to this one. |
CharArray |
append(String str)
Appends the supplied string to the end of this character array. |
char |
charAt(int pos)
Returns the character that is at the specified position in the array. |
boolean |
compareLower(String lowerStr,
int offset)
Compares the supplied uppercase string with the contents of the character array, starting at the offset specified. |
boolean |
compareLowerSubstr(String lowerStr)
This compares a substring of this character array (as specified by the setSubstr(int, int) method call) with the supplied
string. |
String |
getLowerSubstr()
Returns the substring that was specified by the setSubstr(int, int) call. |
private void |
grow(int minSize)
Grows the internal array by either ~100% or minSize (whichever is larger), up to a maximum size of Integer.MAX_VALUE. |
int |
length()
Returns the current length of the character array. |
void |
setLength(int newSize)
Changes the size of the character array to the value specified. |
void |
setSubstr(int begin,
int end)
Allows an arbitrary substring of this character array to be specified. |
int |
substrHashCode()
Returns the hashcode for a lowercase version of the array's substring (as set by the setSubstr(int, int) method). |
String |
substring(int begin,
int end)
Returns a substring from within this character array. |
String |
toString()
Returns a String represenation of the character array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
int size
char[] buffer
int subStrStart
int subStrLen
Constructor Detail |
---|
public CharArray(int size)
Method Detail |
---|
public String toString()
toString
in class Object
public char charAt(int pos)
public void setLength(int newSize)
newSize
- the new size of the character arraypublic int length()
public CharArray append(CharArray chars)
public CharArray append(char[] chars)
private CharArray append(char[] chars, int length)
public CharArray append(char c)
public CharArray append(String str)
public String substring(int begin, int end)
public void setSubstr(int begin, int end)
compareLowerSubstr(String)
to set the range of the substring comparison.
begin
- the starting offset into the character array.end
- the ending offset into the character array.public String getLowerSubstr()
setSubstr(int, int)
call.
public boolean compareLowerSubstr(String lowerStr)
setSubstr(int, int)
method call) with the supplied
string. The supplied string must be lowercase, otherwise
the comparison will fail.
public int substrHashCode()
setSubstr(int, int)
method).
This uses the same calculation as the String.hashCode() method
so that it remains compatible with the hashcodes of normal strings.
public boolean compareLower(String lowerStr, int offset)
private final void grow(int minSize)
|
www.opensymphony.com/sitemesh/ | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |