anchor.diff:  
     ENDMETHOD.                    "decode_tree
   
  +  METHOD zlib_compress_length.
  +    DATA: ls_data           TYPE lcl_zlib=>ty_decompress,
  +          lv_compressed_len TYPE i,
  +          lv_decompressed   TYPE xstring,
  +          lv_adler32        TYPE lcl_hash=>ty_adler32.
  +
  +    ls_data = lcl_zlib=>decompress( cv_data ).
  +    lv_compressed_len = ls_data-compressed_len.
  +    lv_decompressed = ls_data-raw.
  +
  +    IF lv_compressed_len IS INITIAL.
  +      lcx_exception=>raise( 'Decompression falied :o/' ).
  +    ENDIF.
  +
  +    cv_data = cv_data+lv_compressed_len.
  +
  +    lv_adler32 = lcl_hash=>adler32( lv_decompressed ).
  +    IF cv_data(4) <> lv_adler32.
  +      cv_data = cv_data+1.
  +    ENDIF.
  +    IF cv_data(4) <> lv_adler32.
  +      cv_data = cv_data+1.
  +    ENDIF.
  +    IF cv_data(4) <> lv_adler32.
  +      lcx_exception=>raise( 'Wrong Adler checksum' ).
  +    ENDIF.
  +  ENDMETHOD.
  +
     METHOD decode.
   
       DATA: lv_x              TYPE x,
  
positive.code:             gzip_out_len   = lv_compressed_len ).
  
          IF lv_compressed(lv_compressed_len) <> lv_data(lv_compressed_len).
            lcx_exception=>raise( 'Compressed data doesnt match' ).
          ENDIF.
  
          lv_data = lv_data+lv_compressed_len.
  
        ELSEIF lv_zlib = c_zlib_hmm.
  * cl_abap_gzip copmression works for header '789C', but does not work for
  * '7801', call custom implementation of DEFLATE algorithm.
  * The custom implementation could handle both, but most likely the kernel
  * implementation runs faster than the custom ABAP.
          ls_data = lcl_zlib=>decompress( lv_data ).
          lv_compressed_len = ls_data-compressed_len.
          lv_decompressed = ls_data-raw.
  
          IF lv_compressed_len IS INITIAL.
            lcx_exception=>raise( 'Decompression falied :o/' ).
          ENDIF.
  
          lv_data = lv_data+lv_compressed_len.
  
          lv_adler32 = lcl_hash=>adler32( lv_decompressed ).
          IF lv_data(4) <> lv_adler32.
            lv_data = lv_data+1.
          ENDIF.
          IF lv_data(4) <> lv_adler32.
            lv_data = lv_data+1.
          ENDIF.
          IF lv_data(4) <> lv_adler32.
            lcx_exception=>raise( 'Wrong Adler checksum' ).
          ENDIF.
  
        ENDIF.
  
        lv_data = lv_data+4. " skip adler checksum
  
negative.code:     CLASS-METHODS get_length
        EXPORTING ev_length TYPE i
        CHANGING  cv_data   TYPE xstring.
  
      CLASS-METHODS zlib_compress_length
          CHANGING cv_data TYPE xstring
          RAISING lcx_exception.
  
  ENDCLASS.                    "lcl_pack DEFINITION
  
  