@Test public void testDivineDeflateParameters_File() throws IOException { File tempFile = File.createTempFile("ddcdt", "tmp"); tempFile.deleteOnExit(); try { UnitTestZipArchive.saveTestZip(tempFile); List<DivinationResult> results = diviner.divineDeflateParameters(tempFile); Assert.assertEquals(UnitTestZipArchive.allEntriesInFileOrder.size(), results.size()); for (int x = 0; x < results.size(); x++) { UnitTestZipEntry expected = UnitTestZipArchive.allEntriesInFileOrder.get(x); DivinationResult actual = results.get(x); Assert.assertEquals(expected.path, actual.minimalZipEntry.getFileName()); int expectedLevel = expected.level; if (expectedLevel > 0) { Assert.assertTrue(actual.minimalZipEntry.isDeflateCompressed()); Assert.assertNotNull(actual.divinedParameters); Assert.assertEquals(expectedLevel, actual.divinedParameters.level); Assert.assertEquals(0, actual.divinedParameters.strategy); Assert.assertTrue(actual.divinedParameters.nowrap); } else { Assert.assertFalse(actual.minimalZipEntry.isDeflateCompressed()); Assert.assertNull(actual.divinedParameters); } } } finally { try { tempFile.delete(); } catch (Exception ignoreD) { } } }
public List<DivinationResult> divineDeflateParameters(File archiveFile) throws IOException { List<DivinationResult> results = new ArrayList<DivinationResult>(); for (MinimalZipEntry minimalZipEntry : MinimalZipArchive.listEntries(archiveFile)) { JreDeflateParameters divinedParameters = null; if (minimalZipEntry.isDeflateCompressed()) { RandomAccessFileInputStreamFactory rafisFactory = new RandomAccessFileInputStreamFactory( archiveFile, minimalZipEntry.getFileOffsetOfCompressedData(), minimalZipEntry.getCompressedSize()); divinedParameters = divineDeflateParameters(rafisFactory); } results.add(new DivinationResult(minimalZipEntry, divinedParameters)); } return results; }
DefaultDeflateCompressionDiviner { public List<DivinationResult> divineDeflateParameters(File archiveFile) throws IOException { List<DivinationResult> results = new ArrayList<DivinationResult>(); for (MinimalZipEntry minimalZipEntry : MinimalZipArchive.listEntries(archiveFile)) { JreDeflateParameters divinedParameters = null; if (minimalZipEntry.isDeflateCompressed()) { RandomAccessFileInputStreamFactory rafisFactory = new RandomAccessFileInputStreamFactory( archiveFile, minimalZipEntry.getFileOffsetOfCompressedData(), minimalZipEntry.getCompressedSize()); divinedParameters = divineDeflateParameters(rafisFactory); } results.add(new DivinationResult(minimalZipEntry, divinedParameters)); } return results; } }
DefaultDeflateCompressionDiviner { public List<DivinationResult> divineDeflateParameters(File archiveFile) throws IOException { List<DivinationResult> results = new ArrayList<DivinationResult>(); for (MinimalZipEntry minimalZipEntry : MinimalZipArchive.listEntries(archiveFile)) { JreDeflateParameters divinedParameters = null; if (minimalZipEntry.isDeflateCompressed()) { RandomAccessFileInputStreamFactory rafisFactory = new RandomAccessFileInputStreamFactory( archiveFile, minimalZipEntry.getFileOffsetOfCompressedData(), minimalZipEntry.getCompressedSize()); divinedParameters = divineDeflateParameters(rafisFactory); } results.add(new DivinationResult(minimalZipEntry, divinedParameters)); } return results; }  }
DefaultDeflateCompressionDiviner { public List<DivinationResult> divineDeflateParameters(File archiveFile) throws IOException { List<DivinationResult> results = new ArrayList<DivinationResult>(); for (MinimalZipEntry minimalZipEntry : MinimalZipArchive.listEntries(archiveFile)) { JreDeflateParameters divinedParameters = null; if (minimalZipEntry.isDeflateCompressed()) { RandomAccessFileInputStreamFactory rafisFactory = new RandomAccessFileInputStreamFactory( archiveFile, minimalZipEntry.getFileOffsetOfCompressedData(), minimalZipEntry.getCompressedSize()); divinedParameters = divineDeflateParameters(rafisFactory); } results.add(new DivinationResult(minimalZipEntry, divinedParameters)); } return results; }  List<DivinationResult> divineDeflateParameters(File archiveFile); JreDeflateParameters divineDeflateParameters(
      MultiViewInputStreamFactory<?> compressedDataInputStreamFactory); }
DefaultDeflateCompressionDiviner { public List<DivinationResult> divineDeflateParameters(File archiveFile) throws IOException { List<DivinationResult> results = new ArrayList<DivinationResult>(); for (MinimalZipEntry minimalZipEntry : MinimalZipArchive.listEntries(archiveFile)) { JreDeflateParameters divinedParameters = null; if (minimalZipEntry.isDeflateCompressed()) { RandomAccessFileInputStreamFactory rafisFactory = new RandomAccessFileInputStreamFactory( archiveFile, minimalZipEntry.getFileOffsetOfCompressedData(), minimalZipEntry.getCompressedSize()); divinedParameters = divineDeflateParameters(rafisFactory); } results.add(new DivinationResult(minimalZipEntry, divinedParameters)); } return results; }  List<DivinationResult> divineDeflateParameters(File archiveFile); JreDeflateParameters divineDeflateParameters(
      MultiViewInputStreamFactory<?> compressedDataInputStreamFactory);  }