StringBuffer is a variable size contiguous indexable array of characters. The length of the StringBuffer is the number of characters it contains. The capacity of the StringBuffer is the number of characters it can hold. Characters may be inserted at any position up to the length of the StringBuf
| 38 | * @since 1.0 |
| 39 | */ |
| 40 | public final class StringBuffer extends AbstractStringBuilder implements |
| 41 | Appendable, Serializable, CharSequence { |
| 42 | |
| 43 | private static final long serialVersionUID = 3388685877147921107L; |
| 44 | |
| 45 | // private static final ObjectStreamField serialPersistentFields[] = { |
| 46 | // new ObjectStreamField("count", int.class), //$NON-NLS-1$ |
| 47 | // new ObjectStreamField("shared", boolean.class), //$NON-NLS-1$ |
| 48 | // new ObjectStreamField("value", char[].class), }; //$NON-NLS-1$ |
| 49 | |
| 50 | /** |
| 51 | * Constructs a new StringBuffer using the default capacity which is 16. |
| 52 | */ |
| 53 | public StringBuffer() { |
| 54 | super(); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Constructs a new StringBuffer using the specified capacity. |
| 59 | * |
| 60 | * @param capacity |
| 61 | * the initial capacity. |
| 62 | */ |
| 63 | public StringBuffer(int capacity) { |
| 64 | super(capacity); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Constructs a new StringBuffer containing the characters in the specified |
| 69 | * string. The capacity of the new buffer will be the length of the |
| 70 | * {@code String} plus the default capacity. |
| 71 | * |
| 72 | * @param string |
| 73 | * the string content with which to initialize the new instance. |
| 74 | * @throws NullPointerException |
| 75 | * if {@code string} is {@code null}. |
| 76 | */ |
| 77 | public StringBuffer(String string) { |
| 78 | super(string); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Constructs a StringBuffer and initializes it with the content from the |
| 83 | * specified {@code CharSequence}. The capacity of the new buffer will be |
| 84 | * the length of the {@code CharSequence} plus the default capacity. |
| 85 | * |
| 86 | * @param cs |
| 87 | * the content to initialize the instance. |
| 88 | * @throws NullPointerException |
| 89 | * if {@code cs} is {@code null}. |
| 90 | * @since 1.5 |
| 91 | */ |
| 92 | public StringBuffer(CharSequence cs) { |
| 93 | super(cs.toString()); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Adds the string representation of the specified boolean to the end of |
nothing calls this directly
no outgoing calls
no test coverage detected