Search in sources :

Example 1 with DeflateCompressorInputStream

use of org.apache.commons.compress.compressors.deflate.DeflateCompressorInputStream in project beam by apache.

the class FileBasedSinkTest method testCompressionTypeDEFLATE.

/** {@link CompressionType#DEFLATE} correctly writes deflate data. */
@Test
public void testCompressionTypeDEFLATE() throws FileNotFoundException, IOException {
    final File file = writeValuesWithWritableByteChannelFactory(CompressionType.DEFLATE, "abc", "123");
    // Read Gzipped data back in using standard API.
    assertReadValues(new BufferedReader(new InputStreamReader(new DeflateCompressorInputStream(new FileInputStream(file)), StandardCharsets.UTF_8.name())), "abc", "123");
}
Also used : DeflateCompressorInputStream(org.apache.commons.compress.compressors.deflate.DeflateCompressorInputStream) InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) File(java.io.File) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Aggregations

BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStreamReader (java.io.InputStreamReader)1 DeflateCompressorInputStream (org.apache.commons.compress.compressors.deflate.DeflateCompressorInputStream)1 Test (org.junit.Test)1