private void testExtraFlags(final int compressionLevel, final int flag) throws Exception {
final FileInputStream fis = new FileInputStream(getFile("test3.xml"));
byte[] content;
try {
content = IOUtils.toByteArray(fis);
} finally {
fis.close();
}
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
final GzipParameters parameters = new GzipParameters();
parameters.setCompressionLevel(compressionLevel);
final GzipCompressorOutputStream out = new GzipCompressorOutputStream(bout, parameters);
IOUtils.copy(new ByteArrayInputStream(content), out);
out.flush();
out.close();
assertEquals("extra flags (XFL)", flag, bout.toByteArray()[8]);
}
|