### Question:
ByteBufferInputStream extends InputStream { @Override public long skip(long n) { int skipCount = (int)Math.min(n, myBuffer.remaining()); myBuffer.position(myBuffer.position() + skipCount); return skipCount; } ByteBufferInputStream(ByteBuffer buffer); @Override int available(); @Override synchronized void mark(int readlimit); @Override boolean markSupported(); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] array, int offset, int length); @Override synchronized void reset(); @Override long skip(long n);  }### Answer:
@Test public void testSkip() { ByteBuffer buf = createBuffer(); ByteBufferInputStream bbis = new ByteBufferInputStream(buf); Assert.assertEquals(5, bbis.skip(5)); Assert.assertEquals(LIMIT - OFFSET - 5, bbis.available()); byte[] arr = new byte[bbis.available()]; bbis.read(arr); for (int index = 0; index < arr.length; ++index) { Assert.assertEquals(buf.get(index + OFFSET + 5), arr[index]); } }