java.lang
Class StringBuffer

java.lang.Object
  extended by java.lang.StringBuffer
All Implemented Interfaces:
CharSequence

public final class StringBuffer
extends Object
implements CharSequence

An expandable string of characters. Actually not very expandable! 09/25/2001 added number formatting thanks to Martin E. Nielsen. You must ensure that the buffer is large enough to take the formatted number.

Author:
Martin E. Nielsen, Sven Köhler

Constructor Summary
StringBuffer()
           
StringBuffer(CharSequence seq)
           
StringBuffer(int length)
           
StringBuffer(String aString)
           
 
Method Summary
 StringBuffer append(boolean aBoolean)
           
 StringBuffer append(char aChar)
           
 StringBuffer append(char[] c)
           
 StringBuffer append(char[] c, int off, int len)
           
 StringBuffer append(CharSequence cs)
           
 StringBuffer append(CharSequence cs, int start, int end)
           
 StringBuffer append(double aDouble)
           
 StringBuffer append(float aFloat)
           
 StringBuffer append(int i)
           
 StringBuffer append(long aLong)
           
 StringBuffer append(Object aObject)
           
 StringBuffer append(String s)
           
 StringBuffer append(StringBuffer sb)
           
 StringBuffer appendCodePoint(int cp)
           
 int capacity()
           
 char charAt(int i)
           
 StringBuffer delete(int start, int end)
           
 StringBuffer deleteCharAt(int index)
           
 void ensureCapacity(int minCapacity)
           
 void getChars(int start, int end, char[] dst, int dstStart)
          Retrieves the contents of the StringBuilder in the form of an array of characters.
 int indexOf(String str)
           
 int indexOf(String str, int fromIndex)
           
 int lastIndexOf(String str)
           
 int lastIndexOf(String str, int fromIndex)
           
 int length()
           
 void setCharAt(int i, char ch)
           
 void setLength(int newLen)
           
 CharSequence subSequence(int start, int end)
           
 String substring(int start)
           
 String substring(int start, int end)
           
 String toString()
           
 void trimToSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringBuffer

public StringBuffer()

StringBuffer

public StringBuffer(CharSequence seq)

StringBuffer

public StringBuffer(int length)

StringBuffer

public StringBuffer(String aString)
Method Detail

ensureCapacity

public void ensureCapacity(int minCapacity)

delete

public StringBuffer delete(int start,
                           int end)

deleteCharAt

public StringBuffer deleteCharAt(int index)

append

public StringBuffer append(String s)

append

public StringBuffer append(Object aObject)

append

public StringBuffer append(boolean aBoolean)

append

public StringBuffer append(char aChar)

append

public StringBuffer append(char[] c)

append

public StringBuffer append(char[] c,
                           int off,
                           int len)

append

public StringBuffer append(CharSequence cs)

append

public StringBuffer append(StringBuffer sb)

append

public StringBuffer append(CharSequence cs,
                           int start,
                           int end)

append

public StringBuffer append(int i)

append

public StringBuffer append(long aLong)

append

public StringBuffer append(float aFloat)

append

public StringBuffer append(double aDouble)

appendCodePoint

public StringBuffer appendCodePoint(int cp)

capacity

public int capacity()

indexOf

public int indexOf(String str)

indexOf

public int indexOf(String str,
                   int fromIndex)

lastIndexOf

public int lastIndexOf(String str)

lastIndexOf

public int lastIndexOf(String str,
                       int fromIndex)

toString

public String toString()
Specified by:
toString in interface CharSequence
Overrides:
toString in class Object

charAt

public char charAt(int i)
Specified by:
charAt in interface CharSequence

setCharAt

public void setCharAt(int i,
                      char ch)

setLength

public void setLength(int newLen)

length

public int length()
Specified by:
length in interface CharSequence

getChars

public void getChars(int start,
                     int end,
                     char[] dst,
                     int dstStart)
Retrieves the contents of the StringBuilder in the form of an array of characters.


substring

public String substring(int start)

substring

public String substring(int start,
                        int end)

subSequence

public CharSequence subSequence(int start,
                                int end)
Specified by:
subSequence in interface CharSequence

trimToSize

public void trimToSize()