}
public void testAvailableNonEmptySource() throws Exception {
// this byte[] is a deflation of these bytes: { 1, 3, 4, 6 }
byte[] deflated = { 72, -119, 99, 100, 102, 97, 3, 0, 0, 31, 0, 15, 0 };
InputStream in = new InflaterInputStream(new ByteArrayInputStream(deflated));
// InflaterInputStream.available() returns either 1 or 0, even though
// that contradicts the behavior defined in InputStream.available()
assertEquals(1, in.read());
assertEquals(1, in.available());
assertEquals(3, in.read());
assertEquals(1, in.available());
assertEquals(4, in.read());
assertEquals(1, in.available());
assertEquals(6, in.read());
assertEquals(0, in.available());
assertEquals(-1, in.read());
assertEquals(-1, in.read());
}