@Override
    public void write(int b) throws IOException
    {
        checkClosed();

        if (chunkSize - currentBufferPointer <= 0)
        {
            expandBuffer();
        }
        currentBuffer.put((byte) b);
        currentBufferPointer++;
        pointer++;
        if (pointer > size)
        {
            size = pointer;
        }
    }
@Test
    void testClose() throws IOException
    {
        RandomAccess randomAccessReadWrite = new RandomAccessReadWriteBuffer();
        randomAccessReadWrite.write(new byte[] { 1, 2, 3, 4 });
        assertFalse(randomAccessReadWrite.isClosed());
        randomAccessReadWrite.close();
        assertTrue(randomAccessReadWrite.isClosed());
    }