|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
org.apache.commons.io.output.StringBuilderWriter
public class StringBuilderWriter
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.
| Field Summary |
|---|
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
StringBuilderWriter()
Construct a new StringBuilder instance with default capacity. |
|
StringBuilderWriter(int capacity)
Construct a new StringBuilder instance with the specified capacity. |
|
StringBuilderWriter(StringBuilder builder)
Construct a new instance with the specified StringBuilder. |
|
| Method Summary | |
|---|---|
Writer |
append(char value)
Append a single character to this Writer. |
Writer |
append(CharSequence value)
Append a character sequence to this Writer. |
Writer |
append(CharSequence value,
int start,
int end)
Append a portion of a character sequence to the StringBuilder. |
void |
close()
Closing this writer has no effect. |
void |
flush()
Flushing this writer has no effect. |
StringBuilder |
getBuilder()
Return the underlying builder. |
String |
toString()
Returns StringBuilder.toString(). |
void |
write(char[] value,
int offset,
int length)
Write a portion of a character array to the StringBuilder. |
void |
write(String value)
Write a String to the StringBuilder. |
| Methods inherited from class java.io.Writer |
|---|
write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public StringBuilderWriter()
StringBuilder instance with default capacity.
public StringBuilderWriter(int capacity)
StringBuilder instance with the specified capacity.
capacity - The initial capacity of the underlying StringBuilderpublic StringBuilderWriter(StringBuilder builder)
StringBuilder.
builder - The String builder| Method Detail |
|---|
public Writer append(char value)
append in interface Appendableappend in class Writervalue - The character to append
public Writer append(CharSequence value)
append in interface Appendableappend in class Writervalue - The character to append
public Writer append(CharSequence value,
int start,
int end)
StringBuilder.
append in interface Appendableappend in class Writervalue - The character to appendstart - The index of the first characterend - The index of the last character + 1
public void close()
close in interface Closeableclose in class Writerpublic void flush()
flush in interface Flushableflush in class Writerpublic void write(String value)
StringBuilder.
write in class Writervalue - The value to write
public void write(char[] value,
int offset,
int length)
StringBuilder.
write in class Writervalue - The value to writeoffset - The index of the first characterlength - The number of characters to writepublic StringBuilder getBuilder()
public String toString()
StringBuilder.toString().
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||