public class StringBuilderWriter extends Writer
| Constructor and Description |
|---|
StringBuilderWriter()
Create a new string writer using the default initial string-buffer
size.
|
StringBuilderWriter(int initialSize)
Create a new string writer using the specified initial string-buffer
size.
|
StringBuilderWriter(StringBuilder sb)
Create a new string writer using a passed in StringBuilder
size.
|
| Modifier and Type | Method and Description |
|---|---|
StringBuilderWriter |
append(char c)
Appends the specified character to this writer.
|
StringBuilderWriter |
append(CharSequence csq) |
StringBuilderWriter |
append(CharSequence csq,
int start,
int end) |
void |
close() |
void |
flush() |
StringBuilder |
getBuffer()
Return the string buffer itself.
|
void |
reset() |
String |
toString()
Return the buffer's current value as a string.
|
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters.
|
void |
write(int c)
Write a single character.
|
void |
write(String str)
Write a string.
|
void |
write(String str,
int off,
int len)
Write a portion of a string.
|
public StringBuilderWriter()
public StringBuilderWriter(StringBuilder sb)
public StringBuilderWriter(int initialSize)
initialSize - The number of char values that will fit into this buffer
before it is automatically expandedIllegalArgumentException - If initialSize is negativepublic void write(char[] cbuf,
int off,
int len)
public void write(String str, int off, int len)
public StringBuilderWriter append(CharSequence csq)
append in interface Appendableappend in class Writerpublic StringBuilderWriter append(CharSequence csq, int start, int end)
append in interface Appendableappend in class Writerpublic StringBuilderWriter append(char c)
An invocation of this method of the form out.append(c) behaves in exactly the same way as the invocation
out.write(c) append in interface Appendableappend in class Writerc - The 16-bit character to appendpublic String toString()
public StringBuilder getBuffer()
public void reset()
public void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionCopyright © 2017. All rights reserved.