@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); } }
/** * @param stream the stream to write to, should be buffered */ @Override public CompressorOutputStream getCompressorStream(OutputStream stream) throws IOException { if (!framed) { throw new UnsupportedOperationException("Must know the uncompressed size" + " for non-framed snappy"); } return new FramedSnappyCompressorOutputStream(stream); } }