class SegmentedStringWriter
    extends Writer
    implements BufferRecycler.Gettable
{
    final private TextBuffer _buffer;

    public SegmentedStringWriter(BufferRecycler br) {
        super();
        _buffer = new TextBuffer(br);
    }

    /*
    /**********************************************************************
    /* BufferRecycler.Gettable implementation
    /**********************************************************************
     */

    @Override
    public BufferRecycler bufferRecycler() {
        return _buffer.bufferRecycler();
    }

    /*
    /**********************************************************************
    /* java.io.Writer implementation
    /**********************************************************************
     */

    @Override
    public Writer append(char c) throws IOException {
        write(c);
        return this;
    }

    @Override
    public Writer append(CharSequence csq) throws IOException {<FILL_FUNCTION_BODY>}

    @Override
    public Writer append(CharSequence csq, int start, int end) throws IOException {
        String str = csq.subSequence(start, end).toString();
        _buffer.append(str, 0, str.length());
        return this;
    }

    @Override
    public void close() { } // NOP

    @Override
    public void flush() { } // NOP

    @Override
    public void write(char[] cbuf) throws IOException {
        _buffer.append(cbuf, 0, cbuf.length);
    }

    @Override

    public void write(char[] cbuf, int off, int len) throws IOException {
        _buffer.append(cbuf, off, len);
    }

    @Override
    public void write(int c) throws IOException {
        _buffer.append((char) c);
    }

    @Override
    public void write(String str) throws IOException {
        _buffer.append(str, 0, str.length());
    }

    @Override
    public void write(String str, int off, int len) throws IOException {
        _buffer.append(str, off, len);
    }

    /*
    /**********************************************************************
    /* Extended API
    /**********************************************************************
     */

    /**
     * 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.
     *
     * @return String that contains all aggregated content
     * @throws IOException if there are general I/O or parse issues, including if the text is too large,
     * see {@link com.fasterxml.jackson.core.StreamReadConstraints.Builder#maxStringLength(int)}
     */
    public String getAndClear() throws IOException {
        String result = _buffer.contentsAsString();
        _buffer.releaseBuffers();
        return result;
    }
}

        String str = csq.toString();
        _buffer.append(str, 0, str.length());
        return this;
    
<methods>public java.io.Writer append(java.lang.CharSequence) throws java.io.IOException,public java.io.Writer append(char) throws java.io.IOException,public java.io.Writer append(java.lang.CharSequence, int, int) throws java.io.IOException,public abstract void close() throws java.io.IOException,public abstract void flush() throws java.io.IOException,public static java.io.Writer nullWriter() ,public void write(int) throws java.io.IOException,public void write(char[]) throws java.io.IOException,public void write(java.lang.String) throws java.io.IOException,public abstract void write(char[], int, int) throws java.io.IOException,public void write(java.lang.String, int, int) throws java.io.IOException<variables>private static final int WRITE_BUFFER_SIZE,protected java.lang.Object lock,private char[] writeBuffer