question: public static byte [ ] compress ( byte [ ] data ) throws IOException { Deflater deflater = new Deflater ( 9 , Boolean . TRUE ) ; deflater . setInput ( data ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( data . length ) ; deflater . finish ( ) ; byte [ ] buffer = new byte [ 1024 ] ; while ( ! deflater . finished ( ) ) { int count = deflater . deflate ( buffer ) ; outputStream . write ( buffer , 0 , count ) ; } outputStream . close ( ) ; byte [ ] output = outputStream . toByteArray ( ) ; deflater . end ( ) ; return output ; }
target:  Compress given bytes with zip deflate.