public void testInputStreamMethods() throws Exception {
Map<String, String> m = new HashMap<String, String>();
m.put("foo", "bar");
final InputStream is =
new Pack200CompressorInputStream(new FileInputStream(getFile("bla.jar")),
m);
try {
// packed file is a jar, which is a zip so it starts with
// a local file header
assertTrue(is.markSupported());
is.mark(5);
assertEquals(0x50, is.read());
byte[] rest = new byte[3];
assertEquals(3, is.read(rest));
assertEquals(0x4b, rest[0]);
assertEquals(3, rest[1]);
assertEquals(4, rest[2]);
assertEquals(1, is.skip(1));
is.reset();
assertEquals(0x50, is.read());
assertTrue(is.available() > 0);
} finally {
is.close();
}
}