Allow specifying Zstandard compression level
ZstdCompressorOutputStream allows to compress data using Zstandard, but the default compression level of 3 is hard-coded.
Programs that wish to use a different compression level must reimplement ZstdCompressorOutputStream.
I suggest we add a constructor that takes a compression level and passes it to
`new ZstdOutputStream(...)`.
private final ZstdOutputStream encOS;
- public ZstdCompressorOutputStream(final OutputStream out) throws IOException {
- this.encOS = new ZstdOutputStream(out);
+ public ZstdCompressorOutputStream(final OutputStream outStream, int level, boolean closeFrameOnFlush, boolean useChecksum) throws IOException {
+ this.encOS = new ZstdOutputStream(outStream, level, closeFrameOnFlush, useChecksum);
+ }
+
+ public ZstdCompressorOutputStream(final OutputStream outStream, int level, boolean closeFrameOnFlush) throws IOException {
+ this.encOS = new ZstdOutputStream(outStream, level, closeFrameOnFlush);
+ }
+
+ public ZstdCompressorOutputStream(final OutputStream outStream, int level) throws IOException {
+ this.encOS = new ZstdOutputStream(outStream, level);
+ }
+
+ public ZstdCompressorOutputStream(final OutputStream outStream) throws IOException {
+ this.encOS = new ZstdOutputStream(outStream);
}
@Override
