public static byte [ ] decompress ( byte [ ] value , int prefix ) throws CorruptEncodingException { Inflater inflater = cLocalInflater . get ( ) ; if ( inflater == null ) { cLocalInflater . set ( inflater = new Inflater ( ) ) ; } ByteArrayOutputStream bos = new ByteArrayOutputStream ( value . length * 2 ) ; try { bos . write ( value , 0 , prefix ) ; InflaterOutputStream ios = new InflaterOutputStream ( bos , inflater ) ; ios . write ( value , prefix , value . length - prefix ) ; ios . close ( ) ; return bos . toByteArray ( ) ; } catch ( ZipException e ) { // Assume it wasn't compressed. return value ; } catch ( IOException e ) { throw new CorruptEncodingException ( e ) ; } finally { inflater . reset ( ) ; } }
Decodes from compressed form .