@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 testEOFBugInSeek() throws IOException
    {
        try (RandomAccess randomAccessRwedWrite = new RandomAccessReadWriteBuffer())
        {

            byte[] bytes = new byte[RandomAccessReadBuffer.DEFAULT_CHUNK_SIZE_4KB];
            for (int i = 0; i < NUM_ITERATIONS; i++)
            {
                long p0 = randomAccessRwedWrite.getPosition();
                randomAccessRwedWrite.write(bytes);
                long p1 = randomAccessRwedWrite.getPosition();
                assertEquals(RandomAccessReadBuffer.DEFAULT_CHUNK_SIZE_4KB, p1 - p0);
                randomAccessRwedWrite.write(bytes);
                long p2 = randomAccessRwedWrite.getPosition();
                assertEquals(RandomAccessReadBuffer.DEFAULT_CHUNK_SIZE_4KB, p2 - p1);
                randomAccessRwedWrite.seek(0);
                randomAccessRwedWrite.seek(i * 2 * RandomAccessReadBuffer.DEFAULT_CHUNK_SIZE_4KB);
            }
        }
    }