Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4311493

ADLER-32 does not work in java.util.zip.Inflater

XMLWordPrintable

    • jar
    • sparc
    • solaris_2.5.1



      Name: sdC67446 Date: 02/10/2000


      The java.util.zip.Inflater.getAdler() does not return
      the ADLER-32 value of the uncompressed data.
      Currently this method returns the initial value (1)

      The java doc says:
      -------------------------------------------------------------
          /**
           * Returns the ADLER-32 value of the uncompressed data.
           * @return the ADLER-32 value of the uncompressed data
           */
          public synchronized int getAdler()
      ------------------------------------------------------------

      The test:
      -------------------------------------------------------------
      import java.util.zip.*;
      public class Test {
          public static final byte compressedBytes[] = {
              120, -100, -85, -107, -79, 74,
              85, 97, 117, 48, -9, 117, -47, 114, 15, -87, -27, -9, -54,
              -48, 49, -108, 17, 19, 20, 118, -87, -84, 78, -15, -10,
              -87, -112, 51, 115, 16, 85, 81, 54, 11, 114, 44, 11, 98, 116,
              17, 102, -10, 72, -10, 80, -79, 101, 14, 47, -50, 16, 117,
              -9, -83, 16, 13, -55, 83, 83, 103, -30, -117, -42, -82,
              -105, -119, 46, -16, 20, -111, -85, -16, -48, 54, 79,
              -53, -76, 116, -80, -78, 77, -88, -85, 50, 113, -54, 15,
              -74, -28, -44, 101, -43, 47, 85, 54, -74, 1, 0, -34, -35,
              25, 7
              };
          public static void main(String[] args) {
              byte[] buf = new byte[100];
              Inflater inf = new Inflater();
              System.out.println("inf.getAdler(): "+((int)inf.getAdler()));
              inf.setInput(compressedBytes);
              try {
                  while (!inf.needsInput()) {
                      inf.inflate(buf, 0, buf.length);
                  }
                  while (!inf.finished()) {
                      inf.inflate(buf, 0, buf.length);
                  }
              } catch (DataFormatException e) {
                  e.printStackTrace();
              }
              System.out.println("inf.getAdler(): "+((int)inf.getAdler()));
          }
      }
      -------------------------------------------------------------
      Test output:

      inf.getAdler(): 1
      inf.getAdler(): 1
      -------------------------------------------------------------
      ======================================================================

            Unassigned Unassigned
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: