@Test public final void testPreambleOfEmptyZipFile() throws IOException { // Create empty ZIP file. newZipOutputStream(new FileOutputStream(file)).close(); // Assert that the empty ZIP file has no preamble. final ZipFile zipIn = newZipFile(file); try { assertEquals(0, zipIn.getPreambleLength()); final InputStream in = zipIn.getPreambleInputStream(); try { assertEquals(-1, in.read()); } finally { in.close(); } } finally { zipIn.close(); } }