compressor.setLevel(Deflater.BEST_COMPRESSION);
compressor.setInput(bytes);
compressor.finish();
ByteArrayOutputStream bos = new ByteArrayOutputStream(bytes.length);
byte[] buffer = new byte[1024];
while (!compressor.finished()) {
int cnt = compressor.deflate(buffer);
bos.write(buffer, 0, cnt);
}
bos.close();
return bos.toByteArray();