public final class CharBuffer extends CharSegment
_buffer, _length, _offset
Constructor and Description |
---|
CharBuffer()
Constructs a char buffer with no characters.
|
CharBuffer(int capacity)
Constructs a char buffer with the given initial capacity
|
CharBuffer(java.lang.String string)
Constructs a char buffer with the given initial string
|
CharBuffer(java.lang.String string,
int offset,
int length)
Constructs a char buffer with the given initial string
|
Modifier and Type | Method and Description |
---|---|
static CharBuffer |
allocate() |
CharBuffer |
append(boolean b)
Appends the boolean representation to the buffer
|
CharBuffer |
append(byte[] buf,
int offset,
int len)
Appends iso-8859-1 bytes to the buffer
|
CharBuffer |
append(char ch)
Appends the character to the buffer
|
CharBuffer |
append(char[] buffer)
Appends the characters to the buffer.
|
CharBuffer |
append(char[] buffer,
int offset,
int length)
Appends the characters to the buffer.
|
CharBuffer |
append(CharBuffer cb)
Appends the string representation of the object to the buffer.
|
CharBuffer |
append(double d)
Add a double to the buffer.
|
CharBuffer |
append(float f)
Add a float to the buffer.
|
CharBuffer |
append(int i)
Add an int to the buffer.
|
CharBuffer |
append(long i)
Add a long to the buffer.
|
CharBuffer |
append(java.lang.Object obj)
Appends the string representation of the object to the buffer.
|
CharBuffer |
append(java.lang.String string)
Appends the string.
|
CharBuffer |
append(java.lang.String string,
int offset,
int len) |
int |
capacity()
Returns the capacity of the buffer, i.e.
|
char |
charAt(int i)
Returns the char at the specified offset.
|
void |
clear()
Clears the buffer.
|
java.lang.Object |
clone()
Clones the buffer
|
java.lang.String |
close() |
CharBuffer |
delete(int start,
int end)
Deletes characters from the buffer.
|
CharBuffer |
deleteCharAt(int index)
Deletes a character from the buffer.
|
void |
ensureCapacity(int minimumCapacity)
Ensure the buffer can hold at least 'minimumCapacity' chars.
|
void |
free() |
char[] |
getBuffer()
Returns the buffer's char array.
|
int |
getCapacity() |
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Copies characters to the destination buffer.
|
java.io.InputStream |
getInputStream() |
char |
getLastChar()
Returns the last character of the buffer
|
int |
indexOf(char ch)
Returns the index of a character in the CharSegment.
|
CharBuffer |
insert(int offset,
char ch)
Inserts a character at a given offset.
|
CharBuffer |
insert(int index,
char[] buffer,
int offset,
int len)
Inserts a character buffer.
|
CharBuffer |
insert(int offset,
double d)
Inserts a double at a given offset.
|
CharBuffer |
insert(int offset,
float f)
Inserts a float at a given offset.
|
CharBuffer |
insert(int offset,
int i)
Inserts an integer at a given offset.
|
CharBuffer |
insert(int offset,
long l)
Inserts a long at a given offset.
|
CharBuffer |
insert(int offset,
java.lang.Object o)
Inserts an object at a given offset.
|
CharBuffer |
insert(int index,
java.lang.String string)
Inserts a string.
|
CharBuffer |
replace(int start,
int end,
char[] buffer,
int offset,
int len)
Replaces a range with a character array
|
CharBuffer |
replace(int start,
int end,
java.lang.String string)
Replaces a range with a string
|
void |
setCharAt(int index,
char ch)
Sets the character at the given index.
|
void |
setLength(int newLength)
Set the length of the buffer.
|
java.lang.String |
substring(int start)
Returns a substring
|
java.lang.String |
substring(int start,
int end)
Returns a substring
|
java.lang.String |
toString()
String representation of the buffer.
|
endsWith, endsWith, equals, equals, equals, equals, equalsIgnoreCase, equalsIgnoreCase, getLength, getOffset, hashCode, indexOf, indexOf, indexOf, init, lastIndexOf, lastIndexOf, length, matches, matches, matchesIgnoreCase, regionMatches, regionMatches, regionMatchesIgnoreCase, startsWith, subSequence, toLowerCase
public CharBuffer()
public CharBuffer(int capacity)
capacity
- initial capacitypublic CharBuffer(java.lang.String string)
string
- initial stringpublic CharBuffer(java.lang.String string, int offset, int length)
string
- initial stringpublic static CharBuffer allocate()
public void free()
public int capacity()
public int getCapacity()
public final void ensureCapacity(int minimumCapacity)
public final void clear()
public final void setLength(int newLength)
public char charAt(int i)
charAt
in interface java.lang.CharSequence
charAt
in class CharSegment
public char getLastChar()
getLastChar
in class CharSegment
java.lang.IndexOutOfBoundsException
- for an empty bufferpublic final char[] getBuffer()
getBuffer
in class CharSegment
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
getChars
in class CharSegment
public void setCharAt(int index, char ch)
public CharBuffer append(java.lang.Object obj)
public CharBuffer append(CharBuffer cb)
public CharBuffer append(java.lang.String string)
public CharBuffer append(java.lang.String string, int offset, int len)
public CharBuffer append(char[] buffer)
public CharBuffer append(char[] buffer, int offset, int length)
public final CharBuffer append(boolean b)
public final CharBuffer append(char ch)
public CharBuffer append(int i)
public CharBuffer append(long i)
public CharBuffer append(float f)
public CharBuffer append(double d)
public final CharBuffer append(byte[] buf, int offset, int len)
public CharBuffer delete(int start, int end)
public CharBuffer deleteCharAt(int index)
public CharBuffer replace(int start, int end, java.lang.String string)
public CharBuffer replace(int start, int end, char[] buffer, int offset, int len)
public java.lang.String substring(int start)
substring
in class CharSegment
public java.lang.String substring(int start, int end)
substring
in class CharSegment
public CharBuffer insert(int index, java.lang.String string)
public CharBuffer insert(int index, char[] buffer, int offset, int len)
public CharBuffer insert(int offset, java.lang.Object o)
public CharBuffer insert(int offset, char ch)
public CharBuffer insert(int offset, int i)
public CharBuffer insert(int offset, long l)
public CharBuffer insert(int offset, float f)
public CharBuffer insert(int offset, double d)
public int indexOf(char ch)
CharSegment
indexOf
in class CharSegment
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class CharSegment
public java.lang.String close()
public java.io.InputStream getInputStream()