public final class AppendableCharSequence
extends java.lang.Object
implements java.lang.CharSequence, java.lang.Appendable
Modifier | Constructor and Description |
---|---|
private |
AppendableCharSequence(char[] chars) |
|
AppendableCharSequence(int length) |
Modifier and Type | Method and Description |
---|---|
AppendableCharSequence |
append(char c) |
AppendableCharSequence |
append(java.lang.CharSequence csq) |
AppendableCharSequence |
append(java.lang.CharSequence csq,
int start,
int end) |
char |
charAt(int index) |
char |
charAtUnsafe(int index)
Access a value in this
CharSequence . |
private void |
expand() |
private static char[] |
expand(char[] array,
int neededSpace,
int size) |
int |
length() |
void |
reset()
Reset the
AppendableCharSequence . |
AppendableCharSequence |
subSequence(int start,
int end) |
java.lang.String |
substring(int start,
int end)
Create a new
String from the given start to end. |
java.lang.String |
subStringUnsafe(int start,
int end)
Create a new
String from the given start to end. |
java.lang.String |
toString() |
public AppendableCharSequence(int length)
private AppendableCharSequence(char[] chars)
public int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public char charAtUnsafe(int index)
CharSequence
.
This method is considered unsafe as index values are assumed to be legitimate.
Only underlying array bounds checking is done.index
- The index to access the underlying array at.index
.public AppendableCharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public AppendableCharSequence append(char c)
append
in interface java.lang.Appendable
public AppendableCharSequence append(java.lang.CharSequence csq)
append
in interface java.lang.Appendable
public AppendableCharSequence append(java.lang.CharSequence csq, int start, int end)
append
in interface java.lang.Appendable
public void reset()
AppendableCharSequence
. Be aware this will only reset the current internal position and not
shrink the internal char array.public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
public java.lang.String substring(int start, int end)
String
from the given start to end.public java.lang.String subStringUnsafe(int start, int end)
String
from the given start to end.
This method is considered unsafe as index values are assumed to be legitimate.
Only underlying array bounds checking is done.private void expand()
private static char[] expand(char[] array, int neededSpace, int size)