commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject commons-compress git commit: COMPRESS-271 convenience constructor
Date Sat, 28 Jan 2017 09:10:44 GMT
Repository: commons-compress
Updated Branches:
  refs/heads/master 12b7b4d93 -> 76f772691


COMPRESS-271 convenience constructor


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/76f77269
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/76f77269
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/76f77269

Branch: refs/heads/master
Commit: 76f772691c86a7cb2e3fa2b5a8d5370785c0d7f3
Parents: 12b7b4d
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sat Jan 28 10:10:19 2017 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sat Jan 28 10:10:19 2017 +0100

----------------------------------------------------------------------
 .../compressors/lz4/FramedLZ4CompressorOutputStream.java  | 10 ++++++++++
 .../compressors/lz4/FramedLZ4CompressorRoundtripTest.java |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/76f77269/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
index aa59424..91c27b1 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
@@ -101,6 +101,15 @@ public class FramedLZ4CompressorOutputStream extends CompressorOutputStream
{
         public static Parameters DEFAULT = new Parameters(BlockSize.M4, true, false);
 
         /**
+         * Sets up custom a custom block size the LZ4 stream but
+         * otherwise use the defaults of enabled content checksum,
+         * disabled block checksums and independent blocks.
+         * @param blockSize the size of a single block.
+         */
+        public Parameters(BlockSize blockSize) {
+            this(blockSize, true, false);
+        }
+        /**
          * Sets up custom parameters for the LZ4 stream.
          * @param blockSize the size of a single block.
          * @param withContentChecksum whether to write a content checksum
@@ -113,6 +122,7 @@ public class FramedLZ4CompressorOutputStream extends CompressorOutputStream
{
             this.withContentChecksum = withContentChecksum;
             this.withBlockChecksum = withBlockChecksum;
         }
+
         @Override
         public String toString() {
             return "LZ4 Parameters with BlockSize " + blockSize + ", withContentChecksum
" + withContentChecksum

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/76f77269/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
b/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
index 1a14352..fe37a28 100644
--- a/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
@@ -39,9 +39,9 @@ public final class FramedLZ4CompressorRoundtripTest extends AbstractTestCase
{
     @Parameters(name = "using {0}")
     public static Collection<Object[]> factory() {
         return Arrays.asList(new Object[][] {
-             new Object[] { new FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.K64,
true, false) },
-            new Object[] { new FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.K256,
true, false) },
-            new Object[] { new FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.M1,
true, false) },
+            new Object[] { new FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.K64)
},
+            new Object[] { new FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.K256)
},
+            new Object[] { new FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.M1)
},
             new Object[] { FramedLZ4CompressorOutputStream.Parameters.DEFAULT },
             // default without content checksum
             new Object[] { new FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.M4,
false, false) },


Mime
View raw message