Package io.netty.util.internal
Class AppendableCharSequence
java.lang.Object
io.netty.util.internal.AppendableCharSequence
- All Implemented Interfaces:
Appendable
,CharSequence
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AppendableCharSequence
(char[] chars) AppendableCharSequence
(int length) -
Method Summary
Modifier and TypeMethodDescriptionappend
(char c) append
(CharSequence csq) append
(CharSequence csq, int start, int end) char
charAt
(int index) char
charAtUnsafe
(int index) Access a value in thisCharSequence
.private static char[]
expand
(char[] array, int neededSpace, int size) int
length()
void
reset()
Reset theAppendableCharSequence
.void
setLength
(int length) subSequence
(int start, int end) substring
(int start, int end) Create a newString
from the given start to end.subStringUnsafe
(int start, int end) Create a newString
from the given start to end.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
chars
private char[] chars -
pos
private int pos
-
-
Constructor Details
-
AppendableCharSequence
public AppendableCharSequence(int length) -
AppendableCharSequence
private AppendableCharSequence(char[] chars)
-
-
Method Details
-
setLength
public void setLength(int length) -
length
public int length()- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAt
in interfaceCharSequence
-
charAtUnsafe
public char charAtUnsafe(int index) Access a value in thisCharSequence
. This method is considered unsafe as index values are assumed to be legitimate. Only underlying array bounds checking is done.- Parameters:
index
- The index to access the underlying array at.- Returns:
- The value at
index
.
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
append
- Specified by:
append
in interfaceAppendable
-
append
- Specified by:
append
in interfaceAppendable
-
append
- Specified by:
append
in interfaceAppendable
-
reset
public void reset()Reset theAppendableCharSequence
. Be aware this will only reset the current internal position and not shrink the internal char array. -
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
substring
Create a newString
from the given start to end. -
subStringUnsafe
Create a newString
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. -
expand
private static char[] expand(char[] array, int neededSpace, int size)
-