Example usage for org.apache.commons.compress.compressors.zstandard ZstdCompressorOutputStream ZstdCompressorOutputStream

List of usage examples for org.apache.commons.compress.compressors.zstandard ZstdCompressorOutputStream ZstdCompressorOutputStream

Introduction

In this page you can find the example usage for org.apache.commons.compress.compressors.zstandard ZstdCompressorOutputStream ZstdCompressorOutputStream.

Prototype

public ZstdCompressorOutputStream(final OutputStream outStream, int level, boolean closeFrameOnFlush,
        boolean useChecksum) throws IOException 

Source Link

Document

Wraps the given stream into a zstd-jni ZstdOutputStream.

Usage

From source file:com.facebook.buck.step.fs.ZstdStep.java

@Override
public StepExecutionResult execute(ExecutionContext context) throws IOException {
    try (InputStream in = filesystem.newFileInputStream(sourceFile);
            OutputStream out = filesystem.newFileOutputStream(outputPath);
            ZstdCompressorOutputStream zstdOut = new ZstdCompressorOutputStream(out, DEFAULT_COMPRESSION_LEVEL,
                    false, true)) {/*from ww  w .java2  s  .co  m*/
        ByteStreams.copy(in, zstdOut);
    } finally {
        filesystem.deleteFileAtPath(sourceFile);
    }
    return StepExecutionResults.SUCCESS;
}