Skip to content

Commit

Permalink
Implement other ZSTD compression levels airlift#162
Browse files Browse the repository at this point in the history
  • Loading branch information
ZongoForSpeed committed Jul 22, 2023
1 parent 19976e2 commit 671079b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/io/airlift/compress/zstd/ZstdOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@ public class ZstdOutputStream

private boolean closed;


public ZstdOutputStream(OutputStream outputStream)
throws IOException
{
this(outputStream, DEFAULT_COMPRESSION_LEVEL);
}


public ZstdOutputStream(OutputStream outputStream, int compressionLevel)
throws IOException
{
this.outputStream = requireNonNull(outputStream, "outputStream is null");
this.context = new CompressionContext(CompressionParameters.compute(DEFAULT_COMPRESSION_LEVEL, -1), ARRAY_BYTE_BASE_OFFSET, Integer.MAX_VALUE);
this.context = new CompressionContext(CompressionParameters.compute(compressionLevel, -1), ARRAY_BYTE_BASE_OFFSET, Integer.MAX_VALUE);
this.maxBufferSize = context.parameters.getWindowSize() * 4;

// create output buffer large enough for a single block
Expand Down

0 comments on commit 671079b

Please sign in to comment.