Skip to content

Commit

Permalink
#416 Add NoCompression deflate compression level
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanth-lingala committed Mar 25, 2022
1 parent 6b03a60 commit 14281b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
*/
public enum CompressionLevel {

/**
* Level 0 - No compression
*/
NO_COMPRESSION(0),
/**
* Level 1 Deflate compression. Fastest compression.
*/
Expand Down Expand Up @@ -43,7 +47,7 @@ public enum CompressionLevel {
*/
ULTRA(9);

private int level;
private final int level;

CompressionLevel(int level) {
this.level = level;
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/net/lingala/zip4j/CreateZipFileIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@ public void testCreateZipFileWithPreUltraCompressionLevel() throws IOException {
verifyZipFileByExtractingAllFiles(generatedZipFile, outputFolder, 3);
}

@Test
public void testCreateZipFileWithDeflateNoCompressionLevel() throws IOException {
createZipFileWithCompressionLevel(CompressionLevel.NO_COMPRESSION);
verifyZipFileByExtractingAllFiles(generatedZipFile, outputFolder, 3);
}

private void testAddSymlinkThrowsExceptionForMissingTarget(ZipParameters.SymbolicLinkAction symbolicLinkAction)
throws IOException {
File targetFile = Paths.get(temporaryFolder.getRoot().getAbsolutePath(), "foo").toFile();
Expand Down

0 comments on commit 14281b7

Please sign in to comment.