public final class SegmentedStringWriter extends Writer
StringWriter
, based on using segmented
internal buffer. Initial input buffer is also recyclable.
This class is most useful when serializing JSON content as a String:
if so, instance of this class can be given as the writer to
JsonGenerator
.
Modifier and Type | Field and Description |
---|---|
protected TextBuffer |
_buffer |
Constructor and Description |
---|
SegmentedStringWriter(BufferRecycler br) |
Modifier and Type | Method and Description |
---|---|
Writer |
append(char c) |
Writer |
append(CharSequence csq) |
Writer |
append(CharSequence csq,
int start,
int end) |
void |
close() |
void |
flush() |
String |
getAndClear()
Main access method that will construct a String that contains
all the contents, release all internal buffers we may have,
and return result String.
|
void |
write(char[] cbuf) |
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int c) |
void |
write(String str) |
void |
write(String str,
int off,
int len) |
protected final TextBuffer _buffer
public SegmentedStringWriter(BufferRecycler br)
public Writer append(char c)
append
in interface Appendable
append
in class Writer
public Writer append(CharSequence csq)
append
in interface Appendable
append
in class Writer
public Writer append(CharSequence csq, int start, int end)
append
in interface Appendable
append
in class Writer
public void close()
public void flush()
public String getAndClear()