|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.util.FastStringBuffer
public class FastStringBuffer
Fast String buffer.
This class has almost all the methods found in the standardStringBuffer
but is faster for many reasons :
Constructor Summary | |
---|---|
FastStringBuffer()
Constructs a string buffer with no characters in it and an initial capacity of DELTA characters. |
|
FastStringBuffer(char[] buffer,
int count)
Constructs a string buffer from an array of characters. |
|
FastStringBuffer(int length)
Constructs a string buffer with no characters in it and an initial capacity specified by the length argument. |
|
FastStringBuffer(java.lang.String str)
Constructs a string buffer so that it represents the same sequence of characters as the string argument. |
|
FastStringBuffer(java.lang.String str,
int srcBegin,
int srcEnd)
Constructs a string buffer so that it represents the same sequence of characters as the string argument. |
Method Summary | |
---|---|
FastStringBuffer |
append(boolean b)
Appends the string representation of the boolean
argument to the string buffer. |
FastStringBuffer |
append(char c)
Appends the string representation of the char
argument to this string buffer. |
FastStringBuffer |
append(char[] str)
Appends the string representation of the char array
argument to this string buffer. |
FastStringBuffer |
append(char[] str,
int offset,
int len)
Appends the string representation of a subarray of the char array argument to this string buffer. |
FastStringBuffer |
append(double d)
Appends the string representation of the double
argument to this string buffer. |
FastStringBuffer |
append(FastStringBuffer b)
|
FastStringBuffer |
append(FastStringBuffer b,
int srcBegin,
int srcEnd)
|
FastStringBuffer |
append(float f)
Appends the string representation of the float
argument to this string buffer. |
FastStringBuffer |
append(int i)
Appends the string representation of the int
argument to this string buffer. |
FastStringBuffer |
append(long l)
Appends the string representation of the long
argument to this string buffer. |
FastStringBuffer |
append(java.lang.Object obj)
Appends the string representation of the Object
argument to this string buffer. |
FastStringBuffer |
append(java.io.Reader r)
Append the content of a IO reader. |
FastStringBuffer |
append(java.lang.String str)
Appends the string to this string buffer. |
FastStringBuffer |
append(java.lang.String str,
int srcBegin,
int srcEnd)
|
FastStringBuffer |
appendFormat(java.lang.String fmt,
java.lang.Object... args)
Append a formatted string. |
FastStringBuffer |
appendJavaString(java.lang.String s,
boolean addQuotes)
Append a java string to the buffer. |
int |
capacity()
Returns the current capacity of the String buffer. |
char |
charAt(int index)
Returns the character at a specific index in this string buffer. |
void |
clear()
Clear the content of the buffer. |
void |
delete(int begin,
int end)
Delete a part of the buffer. |
boolean |
equals(java.lang.String str)
Compare the buffer to a string. |
void |
flush(java.io.Writer w)
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Characters are copied from this string buffer into the destination character array dst . |
char |
getLastChar()
Get the last character contained in the buffer |
int |
indexOf(char c)
|
int |
indexOf(char c,
int begin)
Search an instance of a char. |
int |
indexOf(java.lang.String string)
|
int |
indexOf(java.lang.String string,
int begin)
Search an instance of a string. |
FastStringBuffer |
insert(int offset,
boolean b)
Inserts the string representation of the boolean
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
char c)
Inserts the string representation of the char
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
char[] str)
Inserts the string representation of the char array
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
double d)
Inserts the string representation of the double
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
float f)
Inserts the string representation of the float
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
int i)
Inserts the string representation of the second int
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
long l)
Inserts the string representation of the long
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
java.lang.Object obj)
Inserts the string representation of the Object
argument into this string buffer. |
FastStringBuffer |
insert(int offset,
java.lang.String str)
Inserts the string into this string buffer. |
int |
lastIndexOf(char c)
|
int |
lastIndexOf(char c,
int end)
Search the last instance of a char. |
int |
length()
Returns the length (character count) of this string buffer. |
FastStringBuffer |
load(java.io.Reader r)
Load the content of a IO reader. |
FastStringBuffer |
prt(java.lang.String fmt)
|
FastStringBuffer |
prt(java.lang.String fmt,
java.lang.Object p1)
|
FastStringBuffer |
prt(java.lang.String fmt,
java.lang.Object p1,
java.lang.Object p2)
|
FastStringBuffer |
prt(java.lang.String fmt,
java.lang.Object p1,
java.lang.Object p2,
java.lang.Object p3)
|
FastStringBuffer |
prt(java.lang.String fmt,
java.lang.Object p1,
java.lang.Object p2,
java.lang.Object p3,
java.lang.Object p4)
|
FastStringBuffer |
prt(java.lang.String fmt,
java.lang.Object p1,
java.lang.Object p2,
java.lang.Object p3,
java.lang.Object p4,
java.lang.Object p5)
|
void |
repeat(char toRepeat,
int count)
Append a repeated character. |
void |
repeat(java.lang.String toRepeat,
int count)
Append a repeated character string. |
void |
replace(int begin,
int end,
char[] replace)
Replace a buffer part. |
void |
replace(int begin,
int end,
FastStringBuffer replace)
Replace a buffer part. |
void |
replace(int begin,
int end,
java.lang.String replace)
Replace a buffer part. |
void |
replace(java.lang.String oldString,
java.lang.String newString)
Replace a set of Strings. |
FastStringBuffer |
reverse()
The character sequence contained in this string buffer is replaced by the reverse of the sequence. |
void |
save(java.io.Writer w)
Save the content to a writer. |
void |
setCharAt(int index,
char ch)
The character at the specified index of tiis string buffer is set to ch . |
boolean |
startsWith(char c)
|
java.lang.String |
substring(int first,
int last)
Extract a part of the string buffer to a string. |
char[] |
toCharArray()
Convert the buffer to an array of chars. |
java.lang.String |
toString()
Converts to a string representing the data in this string buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FastStringBuffer()
public FastStringBuffer(int length)
length
argument.
length
- the initial capacity.public FastStringBuffer(char[] buffer, int count)
buffer
- of characters to be managed by this classcount,
- the number (in char) of useful information contained in the array.
java.lang.IllegalArgumentException
- , if buffer parameter is null.public FastStringBuffer(java.lang.String str)
DELTA
plus the length
of the string argument.
str
- the initial contents of the buffer.public FastStringBuffer(java.lang.String str, int srcBegin, int srcEnd)
DELTA
plus the length
of the string argument.
str
- the initial contents of the buffer.srcBegin
- start copying at this offset in the string.srcEnd
- stop copying at this offset in the string.Method Detail |
---|
public final int length()
public final int capacity()
public final char charAt(int index)
The first character of a string buffer is at index
0
, the next at index 1
, and so on, for
array indexing.
The index argument must be greater than or equal to
0
, and less than the length of this string buffer.
index
- the index of the desired character.
java.lang.StringIndexOutOfBoundsException
- if the index is invalid.com.ibm.jscript.util.FastStringBuffer#length()
,
com.ibm.jscript.util.StringBuffer#length()
public final void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
dst
. The first character to
be copied is at index srcBegin
; the last character to
be copied is at index srcEnd-1.
The total number of
characters to be copied is srcEnd-srcBegin
. The
characters are copied into the subarray of dst
starting
at index dstBegin
and ending at index:
dstbegin + (srcEnd-srcBegin) - 1
srcBegin
- start copying at this offset in the string buffer.srcEnd
- stop copying at this offset in the string buffer.dst
- the array to copy the data into.dstBegin
- offset into dst
.
java.lang.StringIndexOutOfBoundsException
- if there is an invalid
index into the buffer.public final void setCharAt(int index, char ch)
ch
.
The offset argument must be greater than or equal to
0
, and less than the length of this string buffer.
index
- the index of the character to modify.ch
- the new character.
java.lang.StringIndexOutOfBoundsException
- if the index is invalid.com.ibm.jscript.util.StringBuffer#length()
public final FastStringBuffer append(java.lang.Object obj)
Object
argument to this string buffer.
The argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then appended to this string buffer.
obj
- an Object
.
com.ibm.jscript.util.String#valueOf(java.lang.Object)
,
com.ibm.jscript.util.StringBuffer#append(java.lang.String)
public final FastStringBuffer append(java.lang.String str)
The characters of the String
argument are appended, in
order, to the contents of this string buffer, increasing the
length of this string buffer by the length of the argument.
str
- a string.
public final FastStringBuffer append(char[] str)
char
array
argument to this string buffer.
The characters of the array argument are appended, in order, to the contents of this string buffer. The length of this string buffer increases by the length of the argument.
str
- the characters to be appended.
public final FastStringBuffer append(char[] str, int offset, int len)
char
array argument to this string buffer.
Characters of the character array str
, starting at
index offset
, are appended, in order, to the contents
of this string buffer. The length of this string buffer increases
by the value of len
.
str
- the characters to be appended.offset
- the index of the first character to append.len
- the number of characters to append.
public final FastStringBuffer append(boolean b)
boolean
argument to the string buffer.
The argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then appended to this string buffer.
b
- a boolean
.
com.ibm.jscript.util.String#valueOf(boolean)
,
com.ibm.jscript.util.StringBuffer#append(java.lang.String)
public final FastStringBuffer append(char c)
char
argument to this string buffer.
The argument is appended to the contents of this string buffer.
The length of this string buffer increases by 1
.
ch
- a char
.
public final FastStringBuffer append(int i)
int
argument to this string buffer.
The argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then appended to this string buffer.
i
- an int
.
com.ibm.jscript.util.String#valueOf(int)
,
com.ibm.jscript.util.StringBuffer#append(java.lang.String)
public final FastStringBuffer append(long l)
long
argument to this string buffer.
The argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then appended to this string buffer.
l
- a long
.
public final FastStringBuffer append(float f)
float
argument to this string buffer.
The argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then appended to this string buffer.
f
- a float
.
public final FastStringBuffer append(double d)
double
argument to this string buffer.
The argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then appended to this string buffer.
d
- a double
.
public final FastStringBuffer insert(int offset, java.lang.Object obj)
Object
argument into this string buffer.
The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then inserted into this string buffer at the indicated
offset.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.b
- an Object
.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, java.lang.String str)
The characters of the String
argument are inserted, in
order, into this string buffer at the indicated offset. The length
of this string buffer is increased by the length of the argument.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.str
- a string.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, char[] str)
char
array
argument into this string buffer.
The characters of the array argument are inserted into the
contents of this string buffer at the position indicated by
offset
. The length of this string buffer increases by
the length of the argument.
offset
- the offset.ch
- a character array.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, boolean b)
boolean
argument into this string buffer.
The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then inserted into this string buffer at the indicated
offset.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.b
- a boolean
.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, char c)
char
argument into this string buffer.
The second argument is inserted into the contents of this string
buffer at the position indicated by offset
. The length
of this string buffer increases by one.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.ch
- a char
.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, int i)
int
argument into this string buffer.
The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then inserted into this string buffer at the indicated
offset.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.b
- an int
.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, long l)
long
argument into this string buffer.
The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then inserted into this string buffer at the indicated
offset.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.b
- a long
.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, float f)
float
argument into this string buffer.
The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then inserted into this string buffer at the indicated
offset.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.b
- a float
.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer insert(int offset, double d)
double
argument into this string buffer.
The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that
string are then inserted into this string buffer at the indicated
offset.
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this
string buffer.
offset
- the offset.b
- a double
.
java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.public final FastStringBuffer reverse()
public java.lang.String toString()
String
object is allocated and initialized to
contain the character sequence currently represented by this
string buffer. This String
is then returned. Subsequent
changes to the string buffer do not affect the contents of the
String
.
toString
in class java.lang.Object
public final void clear()
public boolean equals(java.lang.String str)
public final boolean startsWith(char c)
public final void repeat(java.lang.String toRepeat, int count)
toRepeat
- the string to repeatcount
- the number of repetitionpublic final void repeat(char toRepeat, int count)
toRepeat
- the character to repeatcount
- the number of repetitionpublic final FastStringBuffer append(FastStringBuffer b, int srcBegin, int srcEnd)
public final FastStringBuffer append(FastStringBuffer b)
public final FastStringBuffer append(java.lang.String str, int srcBegin, int srcEnd)
public final FastStringBuffer load(java.io.Reader r)
public final FastStringBuffer append(java.io.Reader r)
public final void save(java.io.Writer w)
public final void flush(java.io.Writer w) throws java.io.IOException
java.io.IOException
public final char[] toCharArray()
public final java.lang.String substring(int first, int last)
public final void delete(int begin, int end)
public final void replace(int begin, int end, java.lang.String replace)
public final void replace(int begin, int end, char[] replace)
public final void replace(int begin, int end, FastStringBuffer replace)
public final void replace(java.lang.String oldString, java.lang.String newString)
public int indexOf(char c, int begin)
public int indexOf(char c)
public int indexOf(java.lang.String string, int begin)
public int indexOf(java.lang.String string)
public int lastIndexOf(char c, int end)
public int lastIndexOf(char c)
public char getLastChar()
public final FastStringBuffer appendFormat(java.lang.String fmt, java.lang.Object... args)
TString.toString()
is made for each object. By this
way, arrays are properly dumped.
modified by dhan
public final FastStringBuffer prt(java.lang.String fmt, java.lang.Object p1, java.lang.Object p2, java.lang.Object p3, java.lang.Object p4, java.lang.Object p5)
public final FastStringBuffer prt(java.lang.String fmt, java.lang.Object p1, java.lang.Object p2, java.lang.Object p3, java.lang.Object p4)
public final FastStringBuffer prt(java.lang.String fmt, java.lang.Object p1, java.lang.Object p2, java.lang.Object p3)
public final FastStringBuffer prt(java.lang.String fmt, java.lang.Object p1, java.lang.Object p2)
public final FastStringBuffer prt(java.lang.String fmt, java.lang.Object p1)
public final FastStringBuffer prt(java.lang.String fmt)
public FastStringBuffer appendJavaString(java.lang.String s, boolean addQuotes)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |