@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 testAlreadyClose() throws IOException
    {
        try (RandomAccess randomAccessReadWrite = new RandomAccessReadWriteBuffer())
        {
            byte[] bytes = new byte[RandomAccessReadBuffer.DEFAULT_CHUNK_SIZE_4KB];
            randomAccessReadWrite.write(bytes);
            randomAccessReadWrite.close();
            assertThrows(IOException.class, () -> randomAccessReadWrite.seek(0));
        }
    }