@Test public void testSupportsGzip() throws IOException { properties.setProp(ConfigurationKeys.WRITER_CODEC_TYPE, "gzip"); properties.setProp(ConfigurationKeys.SIMPLE_WRITER_DELIMITER, ""); byte[] toWrite = new byte[] { 'a', 'b', 'c', 'd'}; SimpleDataWriter writer = buildSimpleDataWriter(); writer.write(toWrite); writer.close(); writer.commit(); File outputFile = new File(writer.getOutputFilePath()); InputStream in = new GZIPInputStream(new FileInputStream(outputFile)); byte[] contents = IOUtils.toByteArray(in); Assert.assertEquals(contents, toWrite, "Expected gzip'd content to be written out"); Assert.assertTrue(outputFile.getName().endsWith(".gzip"), "Expected gzip'd file to end in .gzip"); }
byte[] toWrite = record.getBytes(); writer.write(toWrite); totalBytes += toWrite.length;
writer.write(randomBytesWrite); writer.close(); writer.commit();
writer.write(toWrite); writer.close(); writer.commit();