public static byte [ ] compress ( byte [ ] value , int prefix ) throws SupportException { Deflater compressor = cLocalDeflater . get ( ) ; if ( compressor == null ) { cLocalDeflater . set ( compressor = new Deflater ( ) ) ; } ByteArrayOutputStream bos = new ByteArrayOutputStream ( value . length ) ; try { bos . write ( value , 0 , prefix ) ; DeflaterOutputStream dout = new DeflaterOutputStream ( bos , compressor ) ; dout . write ( value , prefix , value . length - prefix ) ; dout . close ( ) ; return bos . toByteArray ( ) ; } catch ( IOException e ) { throw new SupportException ( e ) ; } finally { compressor . reset ( ) ; } }
Encodes into compressed form .