### Question:
ByteBufferInputStream extends InputStream { @Override public int available() throws IOException { return bb.remaining(); } ByteBufferInputStream(ByteBuffer bb); @Override int read(); @Override int available(); @Override int read(byte[] b, int off, int len); @Override int read(byte[] b); @Override long skip(long n); static void byteBuffer2Record(ByteBuffer bb, Record record);  }### Answer:
@Test public void testAvailable() throws Exception { for (int i = DATA_BYTES.length; i > 0; i--) { assertEquals(i, in.available()); in.read(); } assertEquals(0, in.available()); }