class RandomAccessReadWriteBuffer extends RandomAccessReadBuffer implements RandomAccess
{
    /**
     * Default constructor.
     */
    public RandomAccessReadWriteBuffer()
    {
        super();
    }

    /**
     * Default constructor.
     */
    public RandomAccessReadWriteBuffer(int definedChunkSize)
    {
        super(definedChunkSize);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void clear() throws IOException
    {
        checkClosed();
        resetBuffers();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void write(int b) throws IOException
    {<FILL_FUNCTION_BODY>}

    /**
     * {@inheritDoc}
     */
    @Override
    public void write(byte[] b) throws IOException
    {
        write(b, 0, b.length);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void write(byte[] b, int off, int len) throws IOException
    {
        checkClosed();

        int remain = len;
        int bOff = off;

        while (remain > 0)
        {
            int bytesToWrite = Math.min(remain, chunkSize - currentBufferPointer);
            if (bytesToWrite <= 0)
            {
                expandBuffer();
                bytesToWrite = Math.min(remain, chunkSize - currentBufferPointer);
            }
            if (bytesToWrite > 0)
            {
                currentBuffer.put(b, bOff, bytesToWrite);
                currentBufferPointer += bytesToWrite;
                pointer += bytesToWrite;
            }
            bOff += bytesToWrite;
            remain -= bytesToWrite;
        }
        if (pointer > size)
        {
            size = pointer;
        }
    }

}

        checkClosed();

        if (chunkSize - currentBufferPointer <= 0)
        {
            expandBuffer();
        }
        currentBuffer.put((byte) b);
        currentBufferPointer++;
        pointer++;
        if (pointer > size)
        {
            size = pointer;
        }
    
<methods>public void <init>(byte[]) ,public void <init>(java.nio.ByteBuffer) ,public void <init>(java.io.InputStream) throws java.io.IOException,public void close() throws java.io.IOException,public static org.apache.pdfbox.io.RandomAccessReadBuffer createBufferFromStream(java.io.InputStream) throws java.io.IOException,public org.apache.pdfbox.io.RandomAccessReadView createView(long, long) throws java.io.IOException,public long getPosition() throws java.io.IOException,public boolean isClosed() ,public boolean isEOF() throws java.io.IOException,public long length() throws java.io.IOException,public int read() throws java.io.IOException,public int read(byte[], int, int) throws java.io.IOException,public void seek(long) throws java.io.IOException<variables>public static final int DEFAULT_CHUNK_SIZE_4KB,private final non-sealed List<java.nio.ByteBuffer> bufferList,private int bufferListIndex,private int bufferListMaxIndex,protected int chunkSize,protected java.nio.ByteBuffer currentBuffer,protected int currentBufferPointer,protected long pointer,private final ConcurrentMap<java.lang.Long,org.apache.pdfbox.io.RandomAccessReadBuffer> rarbCopies,protected long size