| java.lang.Object com.opensymphony.module.sitemesh.html.util.CharArray
CharArray | public class CharArray (Code) | | 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.
author: Chris Miller |
Constructor Summary | |
public | CharArray(int size) Constructs a CharArray that is initialized to the specified size. |
Method Summary | |
public CharArray | append(CharArray chars) Appends an existing CharArray on to this one. | public CharArray | append(char[] chars) Appends the supplied characters to the end of the array. | public CharArray | append(char[] chars, int position, int length) | public CharArray | append(char c) Appends a single character to the end of the character array. | public CharArray | append(String str) Appends the supplied string to the end of this character array. | public char | charAt(int pos) Returns the character that is at the specified position in the array. | final public void | clear() Clear the contents. | public boolean | compareLower(String lowerStr, int offset) Compares the supplied uppercase string with the contents of
the character array, starting at the offset specified.
This is a specialized method to help speed up the FastPageParser
slightly.
The supplied string is assumed to contain only uppercase ASCII
characters. | public boolean | compareLowerSubstr(String lowerStr) This compares a substring of this character array (as specified
by the
CharArray.setSubstr(int,int) method call) with the supplied
string. | public String | getLowerSubstr() Returns the substring that was specified by the
CharArray.setSubstr(int,int) call. | public int | length() Returns the current length of the character array. | public void | setLength(int newSize) Changes the size of the character array to the value specified.
If the new size is less than the current size, the data in the
internal array will be truncated. | public void | setSubstr(int begin, int end) Allows an arbitrary substring of this character array to be specified. | public int | substrHashCode() Returns the hashcode for a lowercase version of the array's substring
(as set by the
CharArray.setSubstr(int,int) method). | public String | substring(int begin, int end) Returns a substring from within this character array. | public String | toString() Returns a String represenation of the character array. | public void | writeTo(PrintWriter writer) |
subStrStart | int subStrStart(Code) | | |
CharArray | public CharArray(int size)(Code) | | Constructs a CharArray that is initialized to the specified size.
Do not pass in a negative value because there is no bounds checking!
|
append | public CharArray append(CharArray chars)(Code) | | Appends an existing CharArray on to this one.
Passing in a null CharArray will result in a NullPointerException.
|
append | public CharArray append(char[] chars)(Code) | | Appends the supplied characters to the end of the array.
|
append | public CharArray append(char[] chars, int position, int length)(Code) | | |
append | public CharArray append(char c)(Code) | | Appends a single character to the end of the character array.
|
append | public CharArray append(String str)(Code) | | Appends the supplied string to the end of this character array.
Passing in a null string will result in a NullPointerException.
|
charAt | public char charAt(int pos)(Code) | | Returns the character that is at the specified position in the array.
There is no bounds checking on this method so be sure to pass in a
sensible value.
|
clear | final public void clear()(Code) | | Clear the contents.
|
compareLower | public boolean compareLower(String lowerStr, int offset)(Code) | | Compares the supplied uppercase string with the contents of
the character array, starting at the offset specified.
This is a specialized method to help speed up the FastPageParser
slightly.
The supplied string is assumed to contain only uppercase ASCII
characters. The offset indicates the offset into the character
array that the comparison should start from.
If (and only if) the supplied string and the relevant portion of the
character array are considered equal, this method will return true.
|
compareLowerSubstr | public boolean compareLowerSubstr(String lowerStr)(Code) | | This compares a substring of this character array (as specified
by the
CharArray.setSubstr(int,int) method call) with the supplied
string. The supplied string must be lowercase, otherwise
the comparison will fail.
|
length | public int length()(Code) | | Returns the current length of the character array.
|
setLength | public void setLength(int newSize)(Code) | | Changes the size of the character array to the value specified.
If the new size is less than the current size, the data in the
internal array will be truncated. If the new size is <= 0,
the array will be reset to empty (but, unlike StringBuffer, the
internal array will NOT be shrunk). If the new size is > the
current size, the array will be padded out with null characters
('\u0000').
Parameters: newSize - the new size of the character array |
setSubstr | public void setSubstr(int begin, int end)(Code) | | Allows an arbitrary substring of this character array to be specified.
This method should be called prior to calling
CharArray.compareLowerSubstr(String) to set the range of the substring comparison.
Parameters: begin - the starting offset into the character array. Parameters: end - the ending offset into the character array. |
substrHashCode | public int substrHashCode()(Code) | | Returns the hashcode for a lowercase version of the array's substring
(as set by the
CharArray.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.
|
substring | public String substring(int begin, int end)(Code) | | Returns a substring from within this character array.
Note that NO range checking is performed!
|
toString | public String toString()(Code) | | Returns a String represenation of the character array.
|
|
|