use of org.apache.commons.compress.compressors.zstandard.ZstdCompressorOutputStream in project flink by apache.
the class GenericCsvInputFormatTest method createTempZStandardFile.
private FileInputSplit createTempZStandardFile(String content) throws IOException {
File tempFile = File.createTempFile("test_contents", "tmp.zst");
tempFile.deleteOnExit();
DataOutputStream dos = new DataOutputStream(new ZstdCompressorOutputStream(new FileOutputStream(tempFile)));
dos.writeBytes(content);
dos.close();
return new FileInputSplit(0, new Path(tempFile.toURI().toString()), 0, tempFile.length(), new String[] { "localhost" });
}
use of org.apache.commons.compress.compressors.zstandard.ZstdCompressorOutputStream in project druid by druid-io.
the class CompressionUtilsTest method testDecompressZstd.
@Test
public void testDecompressZstd() throws IOException {
final File tmpDir = temporaryFolder.newFolder("testDecompressZstd");
final File zstdFile = new File(tmpDir, testFile.getName() + ".zst");
Assert.assertFalse(zstdFile.exists());
try (final OutputStream out = new ZstdCompressorOutputStream(new FileOutputStream(zstdFile))) {
ByteStreams.copy(new FileInputStream(testFile), out);
}
try (final InputStream inputStream = CompressionUtils.decompress(new FileInputStream(zstdFile), zstdFile.getName())) {
assertGoodDataStream(inputStream);
}
}
Aggregations