Package javajs.util
Class SB
java.lang.Object
javajs.util.SB
- Direct Known Subclasses:
QCJSONWriter.SparseArray
Interesting thing here is that JavaScript is 3x faster than Java in handling strings.
Java StringBuilder is final, unfortunately. I guess they weren't thinking about Java2Script!
The reason we have to do this that several overloaded append methods is WAY too expensive
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendB
(boolean b) appendC
(char c) void
appendCB
(char[] cb, int off, int len) appendD
(double d) appendF
(float f) note that JavaScript could drop off the ".0" in "1.0"appendI
(int i) char
charAt
(int i) int
charCodeAt
(int i) int
int
void
int
int
length()
static SB
newN
(int n) static SB
void
void
setLength
(int n) substring
(int i) substring2
(int i, int j) byte[]
toBytes
(int off, int len) simple byte conversion properly implementing UTF-8.toString()
-
Constructor Details
-
SB
public SB()
-
-
Method Details
-
newN
-
newS
-
append
-
appendC
-
appendI
-
appendB
-
appendF
note that JavaScript could drop off the ".0" in "1.0"- Parameters:
f
-- Returns:
- this
-
appendD
-
appendSB
-
appendO
-
appendCB
public void appendCB(char[] cb, int off, int len) -
toString
-
length
public int length() -
indexOf
-
charAt
public char charAt(int i) -
charCodeAt
public int charCodeAt(int i) -
setLength
public void setLength(int n) -
lastIndexOf
-
indexOf2
-
substring
-
substring2
-
toBytes
public byte[] toBytes(int off, int len) simple byte conversion properly implementing UTF-8. * Used for base64 conversion and allows for offset- Parameters:
off
-len
- or -1 for full length (then off must = 0)- Returns:
- byte[]
-
replace
-
insert
-