@Test
public void testAvailable() throws IOException {

  // Available always knows the answer precisely unless the file length exceeds Integer.MAX_VALUE
  Assert.assertEquals(testData.length, stream.available());
  stream.read(new byte[17]);
  Assert.assertEquals(testData.length - 17, stream.available());
  stream.read(new byte[testData.length]);
  Assert.assertEquals(0, stream.available());
  stream.read();
  Assert.assertEquals(0, stream.available());
}