Java Reference
In-Depth Information
public StringBuffer append( int n)
Appends the string representation of the int argument to the StringBuffer calling object and
returns this longer string.
public StringBuffer append( long n)
Appends the string representation of the long argument to the StringBuffer calling object
and returns this longer string.
public StringBuffer append(String ordinaryString)
Appends the String argument to the StringBuffer calling object and returns this longer string.
If ordinaryString is null , then the four characters "null" are appended to this string buffer.
Note that the calling object is hanged and a reference to the changed calling object is returned.
public StringBuffer append(StringBuffer bufferedString)
Appends the StringBuffer argument to the StringBuffer calling object and returns this longer
string. If bufferedString is null , then the four characters "null" are appended to this string
buffer. Note that the calling object is changed and a reference to the changed calling object is returned.
public int capacity()
Returns the current capacity of the calling object. The capacity is the amount of storage currently
available for characters. The capacity will automatically be increased if necessary.
public char charAt( int position)
Returns the character in the calling object string at position . Positions are counted 0, 1, 2, etc.
Throws:
IndexOutOfBoundsException if position is negative or not less than the length of the
calling object.
contentEquals
There is no such method for the class StringBuffer , but see the method contentEquals for
the class String .
public StringBuffer delete( int start, int end)
Removes the characters in a substring of the calling object. The substring to remove begins at
the specifi ed start and extends to the character at index end − 1 or to the end of the calling
object if no such character exists. If start is equal to end , no changes are made. Note that the
calling object is changed and a reference to the changed calling object is returned.
Throws:
StringIndexOutOfBoundsException if start is negative, greater than length(),
or greater than end . StringIndexOutOfBoundsException is a derived class of
RuntimeException , and so is an unchecked exception, which means it is not required to
be caught or declared in a throws clause.
public void ensureCapacity( int minimumCapacity)
Ensures that the capacity of the calling object is at least equal to minimumCapacity . If the current
capacity of the calling object is less than minimumCapacity , then the capacity is increased.
The new capacity is the larger of: minimumCapacity and twice the old capacity , plus 2 .
If the minimumCapacity is nonpositive, this method takes no action and simply returns.
Search WWH ::




Custom Search