### Question:
ByteBufferInputStream extends InputStream { @Override public int available() { return myBuffer.remaining(); } 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 testAvailable() { ByteBuffer buf = createBuffer(); ByteBufferInputStream bbis = new ByteBufferInputStream(buf); Assert.assertEquals(10, bbis.available()); bbis.read(); Assert.assertEquals(9, bbis.available()); buf.get(); Assert.assertEquals(8, bbis.available()); }