public final class

SegmentedStringWriter

extends Writer
java.lang.Object
   ↳ java.io.Writer
     ↳ com.fasterxml.jackson.core.io.SegmentedStringWriter

Class Overview

Efficient alternative to 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.

Summary

Fields
protected final TextBuffer _buffer
[Expand]
Inherited Fields
From class java.io.Writer
Public Constructors
SegmentedStringWriter(BufferRecycler br)
Public Methods
Writer append(CharSequence csq)
Writer append(CharSequence csq, int start, int end)
Writer append(char c)
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(String str)
void write(char[] cbuf, int off, int len)
void write(String str, int off, int len)
void write(int c)
[Expand]
Inherited Methods
From class java.io.Writer
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable
From interface java.lang.Appendable
From interface java.lang.AutoCloseable

Fields

protected final TextBuffer _buffer

Public Constructors

public SegmentedStringWriter (BufferRecycler br)

Public Methods

public Writer append (CharSequence csq)

public Writer append (CharSequence csq, int start, int end)

public Writer append (char c)

public void close ()

public void flush ()

public 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. Note that the method is not idempotent -- if called second time, will just return an empty String.

public void write (char[] cbuf)

public void write (String str)

public void write (char[] cbuf, int off, int len)

public void write (String str, int off, int len)

public void write (int c)