@Test public void testInputStream() throws IOException { final MemoryManager mm = MemoryManager.DEFAULT_MEMORY_MANAGER; Buffer b = mm.allocate(10); b.put((byte) 0x1); b.put((byte) 0xFF); byte[] bytes = new byte[] {(byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 7, (byte) 8}; b.put(bytes); b.flip(); BufferInputStream bis = new BufferInputStream(b); assertEquals(0x1, bis.read()); assertEquals(0xFF, bis.read()); byte[] readBytes = new byte[bytes.length]; bis.read(readBytes); assertArrayEquals(bytes, readBytes); }