@Test
    public void testBasicLookahead() throws IOException {
        InputStream stream = new ByteArrayInputStream(new byte[]{'a', 'b', 'c'});
        InputStream lookahead = new LookaheadInputStream(stream, 2);
        assertEquals('a', lookahead.read());
        assertEquals('b', lookahead.read());
        assertEquals(-1, lookahead.read());
        lookahead.close();
        assertEquals('a', stream.read());
        assertEquals('b', stream.read());
        assertEquals('c', stream.read());
        assertEquals(-1, stream.read());
    }
Test cases for the {@link LookaheadInputStream} class.
tika-core/src/test/java/org/apache/tika/io/LookaheadInputStreamTest.java