Search in sources :

Example 1 with XZCompressorOutputStream

use of org.apache.commons.compress.compressors.xz.XZCompressorOutputStream in project druid by druid-io.

the class CompressionUtilsTest method testDecompressXz.

@Test
public void testDecompressXz() throws IOException {
    final File tmpDir = temporaryFolder.newFolder("testDecompressXz");
    final File xzFile = new File(tmpDir, testFile.getName() + ".xz");
    Assert.assertFalse(xzFile.exists());
    try (final OutputStream out = new XZCompressorOutputStream(new FileOutputStream(xzFile))) {
        ByteStreams.copy(new FileInputStream(testFile), out);
    }
    try (final InputStream inputStream = CompressionUtils.decompress(new FileInputStream(xzFile), xzFile.getName())) {
        assertGoodDataStream(inputStream);
    }
}
Also used : XZCompressorOutputStream(org.apache.commons.compress.compressors.xz.XZCompressorOutputStream) 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