|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.text.FastStringBuffer
Fast, unsynchronized string buffer implementation. This class should not be used. Performance tests have shown that simple String concatenation using the '+' operator is faster.
Constructor Summary | |
FastStringBuffer(int capacity)
Constructs a new FastStringBuffer object with the specified
initial capacity. |
|
FastStringBuffer(int capacity,
String s)
Constructs a new FastStringBuffer object with the specified
initial capacity and content. |
|
FastStringBuffer(String s)
Constructs a new FastStringBuffer object with the specified
initial content. |
Method Summary | |
void |
append(boolean b)
Appends the specified boolean. |
void |
append(byte n)
Appends the string representation of the specified byte . |
void |
append(char c)
Appends the specified character. |
void |
append(char[] cbuf)
Appends all characters in the specified character buffer. |
void |
append(char[] cbuf,
int off,
int len)
Appends characters from the specified character buffer. |
void |
append(double n)
Appends the string representation of the specified double . |
void |
append(float n)
Appends the string representation of the specified float . |
void |
append(int n)
Appends the string representation of the specified int . |
void |
append(long n)
Appends the string representation of the specified long . |
void |
append(short n)
Appends the string representation of the specified short . |
void |
append(String str)
Appends all characters in the specified character string. |
void |
clear()
Clears this string buffer. |
void |
crop(int newLength)
Reduces the length of this string buffer. |
int |
getCapacity()
Gets the capacity of this string buffer. |
int |
getLength()
Gets the length of this string buffer. |
char |
setChar(int index,
char newChar)
Sets the character at the specified index. |
String |
toString()
Converts the contents of this buffer to a String object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FastStringBuffer(int capacity) throws IllegalArgumentException
FastStringBuffer
object with the specified
initial capacity.
capacity
- the initial capacity, must be >= 0.
IllegalArgumentException
- if capacity < 0
.public FastStringBuffer(String s) throws IllegalArgumentException
FastStringBuffer
object with the specified
initial content. The capacity will be equal to the length of the
specified string.
s
- the initial content, cannot be null
.
IllegalArgumentException
- if s == null
.public FastStringBuffer(int capacity, String s) throws IllegalArgumentException
FastStringBuffer
object with the specified
initial capacity and content.
capacity
- the initial capacity, must be
>= s.
String.length()
.s
- the initial content, cannot be null
.
IllegalArgumentException
- if s == null
|| capacity < s.
String.length()
.Method Detail |
public void append(boolean b)
b
- the boolean to append, if it is true
then the string
"true"
will be appended, otherwise the string
"false"
will be appended..public void append(char c)
c
- the character to append.public void append(char[] cbuf) throws IllegalArgumentException
cbuf
- the character array to copy characters from, not null
.
IllegalArgumentException
- if cbuf == null
.public void append(char[] cbuf, int off, int len) throws IllegalArgumentException
cbuf
- the character array to copy characters from, not null
.off
- the offset in cbuf
, must be >= 0 and <
cbuf.length
.len
- the number of characters to copy, must be >= 0 and (off +
len)
must be <= cbuf.length
.
IllegalArgumentException
- if cbuf == null
|| off < 0
|| off > cbuf.length
|| len < 0
|| (off + len > cbuf.length)
.public void append(String str) throws IllegalArgumentException
str
- the character string to copy characters from, not null
.
IllegalArgumentException
- if str == null
.public void append(byte n)
byte
.
If necessary, the capacity of this string buffer will be increased.
n
- the number of which the string representation should be added to this
buffer.public void append(short n)
short
.
If necessary, the capacity of this string buffer will be increased.
n
- the number of which the string representation should be added to this
buffer.public void append(int n)
int
.
If necessary, the capacity of this string buffer will be increased.
n
- the number of which the string representation should be added to this
buffer.public void append(long n)
long
.
If necessary, the capacity of this string buffer will be increased.
n
- the number of which the string representation should be added to this
buffer.public void append(float n)
float
.
If necessary, the capacity of this string buffer will be increased.
n
- the number of which the string representation should be added to this
buffer.public void append(double n)
double
.
If necessary, the capacity of this string buffer will be increased.
n
- the number of which the string representation should be added to this
buffer.public int getLength()
getCapacity()
.public int getCapacity()
getLength()
.public char setChar(int index, char newChar) throws IndexOutOfBoundsException
index
- the index at which to set the character, must be <
getLength()
.newChar
- the new character value.
IndexOutOfBoundsException
- if index < 0 || index >=
getLength()
.public void crop(int newLength) throws IllegalArgumentException
newLength
- the new length, must be less than or equal to the current length (see
getLength()
).
IllegalArgumentException
- if newLength < 0
|| newLength > getLength()
.public void clear()
public String toString()
String
object. A
new String
object is created each time this method is called.
String
that contains the same characters
as this string buffer object, never null
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |