Writer implementation that outputs to a StringBuilder.Note
This implementation, as an alternative to
java.io.StringWriter, provides an un-synchronized
(i.e. for use in a single thread) implementation for better performance.
For safe usage with multiple Threads then
java.io.StringWriter should be used.
| Modifier and Type | Field and Description |
|---|---|
| private final StringBuilder | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | StringBuilderWriter(final int
The initial capacity of the underlying capacity)StringBuilderConstructs a new |
| public | StringBuilderWriter(final StringBuilder
The String builder. May be null. builder)Constructs a new instance with the specified |
| Modifier and Type | Method and Description |
|---|---|
| public Writer | Returns: This writer instanceThe character to append value)Overrides java. Implements java. |
| public Writer | Returns: This writer instanceThe character to append value)Overrides java. Implements java. |
| public Writer | Returns: This writer instanceThe character to append value, final int The index of the first character start, final int The index of the last character + 1 end)Overrides java. Implements java. StringBuilder.
|
| public void | close()
Implements abstract java. Implements java. |
| public void | flush()
Implements abstract java. Implements java. |
| public StringBuilder | |
| public String | Returns: The contents of the String builder.Overrides java. StringBuilder#toString().
|
| public void | write(final String
The value to write value)Overrides java. StringBuilder.
|
| public void | write(final char[]
The value to write value, final int The index of the first character offset, final int The number of characters to write length)Implements abstract java. StringBuilder.
|
| builder | back to summary |
|---|---|
| private final StringBuilder builder | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| StringBuilderWriter | back to summary |
|---|---|
| public StringBuilderWriter() Constructs a new | |
| StringBuilderWriter | back to summary |
|---|---|
| public StringBuilderWriter(final int capacity) Constructs a new
| |
| StringBuilderWriter | back to summary |
|---|---|
| public StringBuilderWriter(final StringBuilder builder) Constructs a new instance with the specified If
| |
| append | back to summary |
|---|---|
| public Writer append(final char value) Overrides java. Implements java. Appends a single character to this Writer. | |
| append | back to summary |
|---|---|
| public Writer append(final CharSequence value) Overrides java. Implements java. Appends a character sequence to this Writer.
| |
| append | back to summary |
|---|---|
| public Writer append(final CharSequence value, final int start, final int end) Overrides java. Implements java. Appends a portion of a character sequence to the
| |
| close | back to summary |
|---|---|
| public void close() Implements abstract java. Implements java. Closing this writer has no effect.
| |
| flush | back to summary |
|---|---|
| public void flush() Implements abstract java. Implements java. Flushing this writer has no effect.
| |
| getBuilder | back to summary |
|---|---|
| public StringBuilder getBuilder() Returns the underlying builder.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns | |
| write | back to summary |
|---|---|
| public void write(final String value) Overrides java. Writes a String to the | |
| write | back to summary |
|---|---|
| public void write(final char[] value, final int offset, final int length) Implements abstract java. Writes a portion of a character array to the
| |