public class CompoundStringBuilder extends Object
StringBuilder.| Modifier and Type | Field and Description | 
|---|---|
| protected StringBuilder | buffer | 
| protected int | capacity | 
| protected int | count | 
| protected static int | DEFAULT_INITIAL_CAPACITY | 
| protected int[] | lengths | 
| protected int[] | offsets | 
| Constructor and Description | 
|---|
| CompoundStringBuilder()Constructs a CompoundStringBuilder with a default backing StringBuilder, and the default initial capacity. | 
| CompoundStringBuilder(int capacity)Constructs a CompoundStringBuilder with a default backing StringBuilder, and the specified initial capacity. | 
| CompoundStringBuilder(StringBuilder stringBuilder,
                     int capacity)Constructs a CompoundStringBuilder with the specified backing StringBuilder and initial capacity. | 
| Modifier and Type | Method and Description | 
|---|---|
| int | append(CharSequence charSequence)Appends the contents of the specified substring to the end of this CompoundStringBuilder, incrementing the number
 of substrings by one. | 
| void | clear()Clears this CompoundStringBuilder's backing StringBuilder and sets the number of substrings to zero. | 
| protected void | expandCapacity(int minCapacity) | 
| int | size()Returns the number of strings stored in this CompoundStringBuilder. | 
| CharSequence | subSequence(int index)Returns the substring at the specified index as a  CharSequence. | 
| String | substring(int index)Returns the substring at the specified index as a  String. | 
| int | substringLength(int index)Returns the length of the substring with the specified index. | 
protected StringBuilder buffer
protected int capacity
protected int count
protected static final int DEFAULT_INITIAL_CAPACITY
protected int[] lengths
protected int[] offsets
public CompoundStringBuilder()
public CompoundStringBuilder(int capacity)
capacity - the compound buffer's initial capacity.IllegalArgumentException - if the capacity is less than 1.public CompoundStringBuilder(StringBuilder stringBuilder, int capacity)
stringBuilder - the StringBuilder in which to store the string data.capacity - the compound buffer's initial capacity.IllegalArgumentException - if the stringBuilder is null or if the capacity is less than 1.public int append(CharSequence charSequence)
charSequence - the substring to append.IllegalArgumentException - if the charSequence is null.public void clear()
protected void expandCapacity(int minCapacity)
public int size()
public CharSequence subSequence(int index)
CharSequence.index - the index of the substring to return.IllegalArgumentException - if the index is out of range.public String substring(int index)
String.index - the index of the substring to return.IllegalArgumentException - if the index is out of range.public int substringLength(int index)
index - the index for the substring who's length is returned.IllegalArgumentException - if the index is out of range.