|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.ranides.assira.text.AbstractStrBuilder<Self>
public abstract class AbstractStrBuilder<Self extends AbstractStrBuilder<Self>>
| Constructor Summary | |
|---|---|
AbstractStrBuilder()
|
|
AbstractStrBuilder(int initialCapacity)
|
|
AbstractStrBuilder(String str)
|
|
| Method Summary | |
|---|---|
Self |
append(AbstractStrBuilder str)
Appends another string builder to this string builder. |
Self |
append(AbstractStrBuilder str,
int startIndex,
int length)
Appends part of a string builder to this string builder. |
Self |
append(boolean value)
Appends a boolean value to the string builder. |
Self |
append(char ch)
Appends a char value to the string builder. |
Self |
append(char[] chars)
Appends a char array to the string builder. |
Self |
append(char[] chars,
int startIndex,
int length)
Appends a char array to the string builder. |
Self |
append(CharSequence seq)
Appends a CharSequence to this string builder. |
Self |
append(CharSequence seq,
int start,
int length)
Appends part of a CharSequence to this string builder. |
Self |
append(double value)
Appends a double value to the string builder using String.valueOf. |
Self |
append(float value)
Appends a float value to the string builder using String.valueOf. |
Self |
append(int value)
Appends an int value to the string builder using String.valueOf. |
Self |
append(long value)
Appends a long value to the string builder using String.valueOf. |
Self |
append(Object obj)
Appends an object to this string builder. |
Self |
append(String str)
Appends a string to this string builder. |
Self |
append(StringBuffer str)
Appends a string buffer to this string builder. |
Self |
append(StringBuffer str,
int startIndex,
int length)
Appends part of a string buffer to this string builder. |
Self |
append(String str,
int startIndex,
int length)
Appends part of a string to this string builder. |
Self |
appendNull()
|
Reader |
asReader()
Gets the contents of this builder as a Reader. |
Writer |
asWriter()
Gets this builder as a Writer that can be written to. |
int |
capacity()
|
char |
charAt(int index)
|
Self |
clear()
|
Self |
ensureCapacity(int capacity)
|
boolean |
equals(Object object)
|
char[] |
getChars()
Copies the builder's character array into a new character array. |
char[] |
getChars(char[] destination)
Copies the character array into the specified array. |
char[] |
getChars(int startIndex,
int endIndex)
Copies part of the builder's character array into a new character array. |
void |
getChars(int startIndex,
int endIndex,
char[] destination,
int destinationIndex)
Copies the character array into the specified array. |
int |
hashCode()
|
int |
length()
|
Self |
minimizeCapacity()
|
Self |
resize(int length)
Updates the length of the builder by either dropping the last characters or adding filler of Unicode zero. |
Self |
resize(int length,
char c)
|
Self |
reverse()
Reverses the string builder placing each character in the opposite index. |
Self |
setCharAt(int index,
char ch)
|
Self |
setNullText(String nullText)
|
CharSequence |
subSequence(int startIndex,
int endIndex)
|
String |
substring(int start)
|
String |
substring(int startIndex,
int endIndex)
|
StringBuilder |
toBuilder()
Gets a StringBuffer version of the string builder, creating a new instance each time the method is called. |
String |
toSharedString()
Gets a String version of the string builder by calling the internal constructor of String by reflection. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractStrBuilder()
public AbstractStrBuilder(int initialCapacity)
public AbstractStrBuilder(String str)
| Method Detail |
|---|
public Self setNullText(String nullText)
public int length()
length in interface CharSequencepublic Self resize(int length)
length - the length to set to, must be zero or positive
IndexOutOfBoundsException - if the length is negative
public Self resize(int length,
char c)
public int capacity()
public Self ensureCapacity(int capacity)
public Self minimizeCapacity()
public Self clear()
public char charAt(int index)
charAt in interface CharSequence
public Self setCharAt(int index,
char ch)
public char[] getChars()
public char[] getChars(int startIndex,
int endIndex)
startIndex - the start index, inclusive, must be validendIndex - the end index, exclusive, must be valid except that
if too large it is treated as end of string
IndexOutOfBoundsException - if startIndex is invalid,
or if endIndex is invalid (but endIndex greater than size is valid)public char[] getChars(char[] destination)
destination - the destination array, null will cause an array to be created
public void getChars(int startIndex,
int endIndex,
char[] destination,
int destinationIndex)
startIndex - first index to copy, inclusive, must be validendIndex - last index, exclusive, must be validdestination - the destination array, must not be null or too smalldestinationIndex - the index to start copying in destination
NullPointerException - if the array is null
IndexOutOfBoundsException - if any index is invalidpublic Self appendNull()
public Self append(Object obj)
appendNull().
obj - the object to append
public Self append(CharSequence seq)
appendNull().
append in interface Appendableseq - the CharSequence to append
public Self append(CharSequence seq,
int start,
int length)
appendNull().
append in interface Appendableseq - the CharSequence to appendstartIndex - the start index, inclusive, must be validlength - the length to append, must be valid
public Self append(String str)
appendNull().
str - the string to append
public Self append(String str,
int startIndex,
int length)
appendNull().
str - the string to appendstartIndex - the start index, inclusive, must be validlength - the length to append, must be valid
public Self append(StringBuffer str)
appendNull().
str - the string buffer to append
public Self append(StringBuffer str,
int startIndex,
int length)
appendNull().
str - the string to appendstartIndex - the start index, inclusive, must be validlength - the length to append, must be valid
public Self append(AbstractStrBuilder str)
appendNull().
str - the string builder to append
public Self append(AbstractStrBuilder str,
int startIndex,
int length)
appendNull().
str - the string to appendstartIndex - the start index, inclusive, must be validlength - the length to append, must be valid
public Self append(char[] chars)
appendNull().
chars - the char array to append
public Self append(char[] chars,
int startIndex,
int length)
appendNull().
chars - the char array to appendstartIndex - the start index, inclusive, must be validlength - the length to append, must be valid
public Self append(boolean value)
value - the value to append
public Self append(char ch)
append in interface Appendablech - the value to append
public Self append(int value)
String.valueOf.
value - the value to append
public Self append(long value)
String.valueOf.
value - the value to append
public Self append(float value)
String.valueOf.
value - the value to append
public Self append(double value)
String.valueOf.
value - the value to append
public Self reverse()
public CharSequence subSequence(int startIndex,
int endIndex)
subSequence in interface CharSequencepublic String substring(int start)
public String substring(int startIndex,
int endIndex)
public boolean equals(Object object)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in interface CharSequencetoString in class Objectpublic StringBuilder toBuilder()
public String toSharedString()
WARNING: You must not use the StrBuilder after calling this method as the buffer is now shared with the String object. To ensure this, the internal character array is set to null, so you will get NullPointerExceptions on all method calls.
public Reader asReader()
This method allows the contents of the builder to be read using any standard method that expects a Reader.
To use, simply create a StrBuilder, populate it with
data, call asReader, and then read away.
The internal character array is shared between the builder and the reader. This allows you to append to the builder after creating the reader, and the changes will be picked up. Note however, that no synchronization occurs, so you must perform all operations with the builder and the reader in one thread.
The returned reader supports marking, and ignores the flush method.
public Writer asWriter()
This method allows you to populate the contents of the builder using any standard method that takes a Writer.
To use, simply create a StrBuilder,
call asWriter, and populate away. The data is available
at any time using the methods of the StrBuilder.
The internal character array is shared between the builder and the writer. This allows you to intermix calls that append to the builder and write using the writer and the changes will be occur correctly. Note however, that no synchronization occurs, so you must perform all operations with the builder and the writer in one thread.
The returned writer ignores the close and flush methods.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||