Package javajs.util

Class SB

java.lang.Object
javajs.util.SB
Direct Known Subclasses:
QCJSONWriter.SparseArray

public class SB extends Object
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 Details

    • SB

      public SB()
  • Method Details

    • newN

      public static SB newN(int n)
    • newS

      public static SB newS(String s)
    • append

      public SB append(String s)
    • appendC

      public SB appendC(char c)
    • appendI

      public SB appendI(int i)
    • appendB

      public SB appendB(boolean b)
    • appendF

      public SB appendF(float f)
      note that JavaScript could drop off the ".0" in "1.0"
      Parameters:
      f -
      Returns:
      this
    • appendD

      public SB appendD(double d)
    • appendSB

      public SB appendSB(SB buf)
    • appendO

      public SB appendO(Object data)
    • appendCB

      public void appendCB(char[] cb, int off, int len)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • length

      public int length()
    • indexOf

      public int indexOf(String s)
    • charAt

      public char charAt(int i)
    • charCodeAt

      public int charCodeAt(int i)
    • setLength

      public void setLength(int n)
    • lastIndexOf

      public int lastIndexOf(String s)
    • indexOf2

      public int indexOf2(String s, int i)
    • substring

      public String substring(int i)
    • substring2

      public String substring2(int i, int j)
    • 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

      public void replace(int start, int end, String str)
    • insert

      public void insert(int offset, String str)