@Test public final void testGoodGetCheckedInputStream() throws IOException { // Create test ZIP file. final String name = "entry"; final ZipOutputStream zipOut = newZipOutputStream(new FileOutputStream(file)); zipOut.putNextEntry(newEntry(name)); zipOut.write(data); zipOut.close(); final ZipFile zipIn = newZipFile(file); // Open checked input stream and join immediately. InputStream in = zipIn.getCheckedInputStream(name); in.close(); // Open checked input stream and read fully, using multiple methods. in = zipIn.getCheckedInputStream(name); final int n = data.length / 4; in.skip(n); in.read(new byte[n]); in.read(new byte[n], 0, n); while (in.read() != -1) { // read until EOF } in.close(); zipIn.close(); }
InputStream in = zipIn.getCheckedInputStream(name); if (tweakDD ^ tweakCFH) fail("Expected CRC32Exception!"); InputStream in = zipIn.getCheckedInputStream(name); if (tweakDD ^ tweakCFH) fail("Expected CRC32Exception!");
final InputStream in = zf.getCheckedInputStream(entry); try { int off = 0;