Team LiB
Previous Section Next Section

AbstractStringBuilderjava.lang

Java 5.0appendable

This package-private class is the abstract superclass of StringBuffer and StringBuilder. Because this class is not public, you may not use it directly. It is included in this quick-reference to fully document the shared API of its two subclasses.

Note that many of the methods of this class are declared to return an AbstractStringBuilder object. StringBuilder and StringBuffer( ) override those methods and narrow the return type to StringBuilder or StringBuffer. (This is an example of "covariant returns," which are allowed in Java 5.0 and later.)

Figure 10-2. java.lang.AbstractStringBuilder


abstract class AbstractStringBuilder implements Appendable, CharSequence {
// No Constructor
// Public Instance Methods
     public AbstractStringBuilder append(char[ ] str);  
     public AbstractStringBuilder append(boolean b);  
     public AbstractStringBuilder append(char c);  
     public AbstractStringBuilder append(Object obj);  
     public AbstractStringBuilder append(CharSequence s);  
     public AbstractStringBuilder append(StringBuffer sb);  
     public AbstractStringBuilder append(String str);  
     public AbstractStringBuilder append(int i);  
     public AbstractStringBuilder append(double d);  
     public AbstractStringBuilder append(float f);  
     public AbstractStringBuilder append(long l);  
     public AbstractStringBuilder append(char[ ] str, int offset, int len);  
     public AbstractStringBuilder append(CharSequence s, int start, int end);  
     public AbstractStringBuilder appendCodePoint(int codePoint);  
     public int capacity( );  
     public int codePointAt(int index);  
     public int codePointBefore(int index);  
     public int codePointCount(int beginIndex, int endIndex);  
     public AbstractStringBuilder delete(int start, int end);  
     public AbstractStringBuilder deleteCharAt(int index);  
     public void ensureCapacity(int minimumCapacity);  
     public void getChars(int srcBegin, int srcEnd, char[ ] dst, int dstBegin);  
     public int indexOf(String str);  
     public int indexOf(String str, int fromIndex);  
     public AbstractStringBuilder insert(int offset, char c);  
     public AbstractStringBuilder insert(int offset, boolean b);  
     public AbstractStringBuilder insert(int dstOffset, CharSequence s);  
     public AbstractStringBuilder insert(int offset, int i);  
     public AbstractStringBuilder insert(int offset, double d);  
     public AbstractStringBuilder insert(int offset, float f);  
     public AbstractStringBuilder insert(int offset, long l);  
     public AbstractStringBuilder insert(int offset, char[ ] str);  
     public AbstractStringBuilder insert(int offset, Object obj);  
     public AbstractStringBuilder insert(int offset, String str);  
     public AbstractStringBuilder insert(int index, char[ ] str, int offset, int len);  
     public AbstractStringBuilder insert(int dstOffset, CharSequence s, int start, int end);  
     public int lastIndexOf(String str);  
     public int lastIndexOf(String str, int fromIndex);  
     public int offsetByCodePoints(int index, int codePointOffset);  
     public AbstractStringBuilder replace(int start, int end, String str);  
     public AbstractStringBuilder reverse( );  
     public void setCharAt(int index, char ch);  
     public void setLength(int newLength);  
     public String substring(int start);  
     public String substring(int start, int end);  
     public void trimToSize( );  
// Methods Implementing CharSequence
     public char charAt(int index);  
     public int length( );  
     public CharSequence subSequence(int start, int end);  
     public abstract String toString( );  
}

Subclasses

StringBuffer, StringBuilder

Returned By

Too many methods to list.

    Team LiB
    Previous Section Next Section