Search in sources :

Example 1 with FramedSnappyCompressorOutputStream

use of org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorOutputStream in project druid by druid-io.

the class CompressionUtilsTest method testDecompressSnappy.

@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);
    }
    try (final InputStream inputStream = CompressionUtils.decompress(new FileInputStream(snappyFile), snappyFile.getName())) {
        assertGoodDataStream(inputStream);
    }
}
Also used : FramedSnappyCompressorOutputStream(org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorOutputStream) GZIPInputStream(java.util.zip.GZIPInputStream) FilterInputStream(java.io.FilterInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) CountingInputStream(com.google.common.io.CountingInputStream) InputStream(java.io.InputStream) ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BZip2CompressorOutputStream(org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream) ZstdCompressorOutputStream(org.apache.commons.compress.compressors.zstandard.ZstdCompressorOutputStream) OutputStream(java.io.OutputStream) FramedSnappyCompressorOutputStream(org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorOutputStream) XZCompressorOutputStream(org.apache.commons.compress.compressors.xz.XZCompressorOutputStream) FileOutputStream(java.io.FileOutputStream) FilterOutputStream(java.io.FilterOutputStream) GZIPOutputStream(java.util.zip.GZIPOutputStream) FileOutputStream(java.io.FileOutputStream) File(java.io.File) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Aggregations

CountingInputStream (com.google.common.io.CountingInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 FilterInputStream (java.io.FilterInputStream)1 FilterOutputStream (java.io.FilterOutputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 GZIPOutputStream (java.util.zip.GZIPOutputStream)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 BZip2CompressorOutputStream (org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream)1 FramedSnappyCompressorOutputStream (org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorOutputStream)1 XZCompressorOutputStream (org.apache.commons.compress.compressors.xz.XZCompressorOutputStream)1 ZstdCompressorOutputStream (org.apache.commons.compress.compressors.zstandard.ZstdCompressorOutputStream)1 Test (org.junit.Test)1