Example usage for org.apache.commons.compress.compressors.snappy FramedSnappyCompressorOutputStream FramedSnappyCompressorOutputStream

List of usage examples for org.apache.commons.compress.compressors.snappy FramedSnappyCompressorOutputStream FramedSnappyCompressorOutputStream

Introduction

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

Prototype

public FramedSnappyCompressorOutputStream(final OutputStream out) throws IOException 

Source Link

Document

Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.

Usage

From source file:org.apache.druid.java.util.common.CompressionUtilsTest.java

@Test
public void testDecompressSnappy() throws IOException {
    final File tmpDir = temporaryFolder.newFolder("testDecompressSnappy");
    final File snappyFile = new File(tmpDir, testFile.getName() + ".sz");
    Assert.assertFalse(snappyFile.exists());
    try (final OutputStream out = new FramedSnappyCompressorOutputStream(new FileOutputStream(snappyFile))) {
        ByteStreams.copy(new FileInputStream(testFile), out);
    }/*w ww. j  a va  2s .  co m*/
    try (final InputStream inputStream = CompressionUtils.decompress(new FileInputStream(snappyFile),
            snappyFile.getName())) {
        assertGoodDataStream(inputStream);
    }
}

From source file:org.gradle.caching.internal.tasks.SnappyCommonsPacker.java

@Override
public void pack(List<DataSource> inputs, DataTarget output) throws IOException {
    delegate.pack(inputs, new DelegatingDataTarget(output) {
        @Override/*  www  .j a  v a2s. c om*/
        public OutputStream openOutput() throws IOException {
            return new FramedSnappyCompressorOutputStream(super.openOutput());
        }
    });
}