private void readPartialStream(int testSize) throws IOException {
        InputStream is = createTestInputStream(20);
        try (RereadableInputStream ris = new RereadableInputStream(is, MEMORY_THRESHOLD, true)) {

            int iterations = testSize;
            for (int pass = 0; pass < NUM_PASSES; pass++) {
                for (int byteNum = 0; byteNum < iterations; byteNum++) {
                    int byteRead = ris.read();
                    assertEquals(byteNum, byteRead,
                            "Pass = " + pass + ", byte num should be " + byteNum + " but is " + byteRead + ".");
                }
                ris.rewind();
                iterations++;
            }
        }
    }
Read increasingly more of the stream, but not all, with each pass before rewinding to
make sure we pick up at the correct point
tika-core/src/test/java/org/apache/tika/TestRereadableInputStream.java