public class FastCat
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EMBEDDED_COPYRIGHT
undisplayed copyright notice
|
Constructor and Description |
---|
FastCat()
no-arg constructor, defaults to 20 pieces as the estimate.
|
FastCat(int estNumberOfPieces)
constructor
|
Modifier and Type | Method and Description |
---|---|
FastCat |
append(char c)
append char
|
FastCat |
append(int i)
append int
|
FastCat |
append(java.lang.Object... oo)
append arbitrary number of Objects
|
FastCat |
append(java.lang.Object o)
append Object
|
FastCat |
append(java.lang.String... ss)
append arbitrary number of strings
|
FastCat |
append(java.lang.String s)
append String
|
void |
clear()
empty the concatenated String being created
|
int |
length()
current buffer length.
|
static void |
main(java.lang.String[] args)
test harness
|
int |
room()
how many unused slots are available for pieces?
Not same as total number of chars that could append.
|
int |
size()
how many slots (used or unused) are available for pieces?
Not same as total number of chars that could append.
|
java.lang.String |
toString()
Get the concatenation of all the strings appended so far
|
int |
used()
how many used slot containing pieces?
Not same as total number of chars appended.
|
public static final java.lang.String EMBEDDED_COPYRIGHT
public FastCat()
public FastCat(int estNumberOfPieces)
estNumberOfPieces
- estimated number of chunks you will concatenate.
If the estimate is low, you will get ArrayIndexOutOfBoundsExceptions.public FastCat append(java.lang.String s)
s
- String to appendpublic FastCat append(java.lang.String... ss)
ss
- comma-separated list of Strings to appendpublic FastCat append(int i)
i
- int to append.public FastCat append(char c)
c
- char to append.
If you use this method extensively, you will probably get better performance from StringBuilder.public FastCat append(java.lang.Object o)
o
- Object to append. toString is called to acquire a String to concatenate.public FastCat append(java.lang.Object... oo)
oo
- comma-separated list of Objects to to append. toString is called to acquire a String to concatenate.public void clear()
public int length()
used()
public int room()
public int size()
length()
public java.lang.String toString()
toString
in class java.lang.Object
public int used()
public static void main(java.lang.String[] args)
args
- not used.