public final class StringWriter extends Writer
StringBuilder
. Not like
java.io.StringWriter. it's not multi-thread safety.Constructor and Description |
---|
StringWriter() |
StringWriter(int initialSize) |
StringWriter(StringBuilder sb) |
Modifier and Type | Method and Description |
---|---|
StringWriter |
append(char c) |
StringWriter |
append(CharSequence csq) |
StringWriter |
append(CharSequence csq,
int start,
int end) |
void |
close() |
void |
flush()
Flush.
|
StringBuilder |
stringBuilder() |
String |
toString()
Return the buffer's current value as a string.
|
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int c) |
void |
write(String str) |
void |
write(String str,
int off,
int len) |
public StringWriter()
public StringWriter(int initialSize)
public StringWriter(StringBuilder sb)
public StringBuilder stringBuilder()
public void write(char[] cbuf, int off, int len)
public void write(String str, int off, int len)
public StringWriter append(CharSequence csq) throws IOException
append
in interface Appendable
append
in class Writer
csq
- IOException
- Signals that an I/O exception has occurred.public StringWriter append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
append
in class Writer
csq
- start
- end
- IOException
- Signals that an I/O exception has occurred.public StringWriter append(char c)
append
in interface Appendable
append
in class Writer
c
- public String toString()
public void flush()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
- Signals that an I/O exception has occurred.Copyright © 2020. All rights reserved.