diff --git a/src/main/java/net/lingala/zip4j/model/enums/CompressionLevel.java b/src/main/java/net/lingala/zip4j/model/enums/CompressionLevel.java index d54ef777..a57da8f7 100644 --- a/src/main/java/net/lingala/zip4j/model/enums/CompressionLevel.java +++ b/src/main/java/net/lingala/zip4j/model/enums/CompressionLevel.java @@ -6,6 +6,10 @@ */ public enum CompressionLevel { + /** + * Level 0 - No compression + */ + NO_COMPRESSION(0), /** * Level 1 Deflate compression. Fastest compression. */ @@ -43,7 +47,7 @@ public enum CompressionLevel { */ ULTRA(9); - private int level; + private final int level; CompressionLevel(int level) { this.level = level; diff --git a/src/test/java/net/lingala/zip4j/CreateZipFileIT.java b/src/test/java/net/lingala/zip4j/CreateZipFileIT.java index 79a17659..721f2dda 100644 --- a/src/test/java/net/lingala/zip4j/CreateZipFileIT.java +++ b/src/test/java/net/lingala/zip4j/CreateZipFileIT.java @@ -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();