byte[] data = getBlock(20 * 1024);
File input = File.createTempFile("compress_", "src");
NioUtils.write(data, input);//写入数据到文件
for (int i = 0; i < comps.length; i++) {
Compressor comp = comps[i];
// 基于流的处理
File output = File.createTempFile("compress_", "jkt");
comp.compressTo(input, output);
Compressor icomp = (Compressor) PackableObject.identifyByHeader(output, Arrays.asList(comps));
InputStream decrypt = icomp.decompress(output);
byte[] result = NioUtils.read(decrypt);
check(data, result);
}
} catch (Exception e) {