|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.solr.internal.csv.CharBuffer
public class CharBuffer
A simple StringBuffer replacement that aims to reduce copying as much as possible. The buffer grows as necessary. This class is not thread safe.
Constructor Summary | |
---|---|
CharBuffer()
Creates a new CharBuffer with an initial capacity of 32 characters. |
|
CharBuffer(int length)
Creates a new CharBuffer with an initial capacity of length characters. |
Method Summary | |
---|---|
void |
append(char data)
Appends a single character to the end of this CharBuffer. |
void |
append(char[] data)
Appends data to the end of this CharBuffer. |
void |
append(CharBuffer cb)
Appends the contents of cb to the end of this CharBuffer. |
void |
append(String s)
Appends s to the end of this CharBuffer. |
void |
append(StringBuffer sb)
Appends sb to the end of this CharBuffer. |
int |
capacity()
Returns the current capacity of the buffer. |
char |
charAt(int pos)
Returns the character at the specified position. |
void |
clear()
Empties the buffer. |
char[] |
getCharacters()
Returns the contents of the buffer as a char[]. |
int |
length()
Returns the number of characters in the buffer. |
void |
provideCapacity(int capacity)
Copies the data into a new array of at least capacity size. |
void |
shrink()
Shrinks the capacity of the buffer to the current length if necessary. |
String |
toString()
Converts the contents of the buffer into a StringBuffer. |
StringBuffer |
toStringBuffer()
Converts the contents of the buffer into a StringBuffer. |
void |
trimTrailingWhitespace()
Removes trailing whitespace. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CharBuffer()
public CharBuffer(int length)
length
characters.
Method Detail |
---|
public void clear()
public int length()
public int capacity()
public void append(CharBuffer cb)
cb
to the end of this CharBuffer.
cb
- the CharBuffer to append or nullpublic void append(String s)
s
to the end of this CharBuffer.
This method involves copying the new data once!
s
- the String to append or nullpublic void append(StringBuffer sb)
sb
to the end of this CharBuffer.
This method involves copying the new data once!
sb
- the StringBuffer to append or nullpublic void append(char[] data)
data
to the end of this CharBuffer.
This method involves copying the new data once!
data
- the char[] to append or nullpublic void append(char data)
data
- the char to appendpublic void shrink()
public void trimTrailingWhitespace()
public char[] getCharacters()
public char charAt(int pos)
public StringBuffer toStringBuffer()
public String toString()
toString
in class Object
public void provideCapacity(int capacity)
capacity
size.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |