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
.
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) |
public SegmentedStringWriter(BufferRecycler br)
public Writer append(char c) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public Writer append(CharSequence csq) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public Writer append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
append
in class Writer
IOException
public void close()
public void flush()
public void write(char[] cbuf) throws IOException
write
in class Writer
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
public void write(int c) throws IOException
write
in class Writer
IOException
public void write(String str) throws IOException
write
in class Writer
IOException
public void write(String str, int off, int len) throws IOException
write
in class Writer
IOException
public String getAndClear() throws IOException
IOException
- if there are general I/O or parse issues, including if the text is too large,
see StreamReadConstraints.Builder.maxStringLength(int)
Copyright © 2008–2024 FasterXML. All rights reserved.