@Test public void testAvailable() throws IOException { InputStream is = new LengthLimitedInputStream(raw, 10); assertEquals(10, is.available()); is.skip(100); assertEquals(0, is.available()); }
@Test public void testRead() throws IOException { InputStream is = new LengthLimitedInputStream(raw, 10); byte[] x = new byte[12]; assertEquals(0, is.read()); assertEquals(9, is.read(x)); assertEquals(-1, is.read(x)); assertEquals(x[8], 9); } }