ix.util
Class SimpleStringBuffer

java.lang.Object
  extended by ix.util.SimpleStringBuffer

public final class SimpleStringBuffer
extends java.lang.Object

Simple version of StringBuffer without synchronized methods and with no ability to grow beyond its initial capacity. It can therefore be used when you know the result length or a definite upper bound.

It also has a different, and much smaller, set of methods, Note that the append methods do not return the buffer, and that there is a method for appending a substring.


Constructor Summary
SimpleStringBuffer(int capacity)
          Creates an empty buffer with the indicated capacity.
 
Method Summary
 void append(char c)
          Appends a single character.
 void append(java.lang.String s)
          Appends all the characters in a String.
 void append(java.lang.String s, int beginIndex, int endIndex)
          Appends a substring.
 void appendCapitalized(java.lang.String s)
          Appends the string with its first character converted to upper case.
 void appendUncapitalized(java.lang.String s)
          Appends the string with its first character converted to lower case.
 int length()
          Returns the number of characters currently in the buffer.
 java.lang.String toString()
          Returns a String containing all the characters that have so far been added to the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleStringBuffer

public SimpleStringBuffer(int capacity)
Creates an empty buffer with the indicated capacity.

Method Detail

length

public int length()
Returns the number of characters currently in the buffer.


append

public void append(java.lang.String s)
Appends all the characters in a String.


append

public void append(java.lang.String s,
                   int beginIndex,
                   int endIndex)
Appends a substring. The substring contains the characters at beginIndex through to endIndex - 1, and its length is therefore endIndex - beginIndex.


appendCapitalized

public void appendCapitalized(java.lang.String s)
Appends the string with its first character converted to upper case.


appendUncapitalized

public void appendUncapitalized(java.lang.String s)
Appends the string with its first character converted to lower case.


append

public void append(char c)
Appends a single character.


toString

public java.lang.String toString()
Returns a String containing all the characters that have so far been added to the buffer.

Overrides:
toString in class java.lang.Object