Package java.util.zip

Examples of java.util.zip.Adler32.reset()


            Long.toHexString(checksum) + " (expected 0x" +
            Integer.toHexString(hitem) + ")");
      }
      if (extraField) { // lzop 1.08 ultimately ignores this
        LOG.debug("Extra header field not processed");
        adler.reset();
        crc32.reset();
        hitem = readHeaderItem(in, buf, 4, adler, crc32);
        readHeaderItem(in, new byte[hitem], hitem, adler, crc32);
        checksum = (int)(useCRC32 ? crc32.getValue() : adler.getValue());
        if (checksum != readHeaderItem(in, buf, 4, adler, crc32)) {
View Full Code Here


          Long.toHexString(checksum) + " (expected 0x" +
          Integer.toHexString(hitem) + ")");
    }
    if (extraField) { // lzop 1.08 ultimately ignores this
      LOG.debug("Extra header field not processed");
      adler.reset();
      crc32.reset();
      hitem = readHeaderItem(in, buf, 4, adler, crc32);
      readHeaderItem(in, new byte[hitem], hitem, adler, crc32);
      checksum = (int)(useCRC32 ? crc32.getValue() : adler.getValue());
      if (checksum != readHeaderItem(in, buf, 4, adler, crc32)) {
View Full Code Here

                    + Long.toHexString(checksum) + " (expected 0x"
                    + Integer.toHexString(hitem) + ")");
        }
        if (extraField) { // lzop 1.08 ultimately ignores this
            LOG.debug("Extra header field not processed");
            adler.reset();
            crc32.reset();
            hitem = readHeaderItem(buf, 4, adler, crc32);
            readHeaderItem(new byte[hitem], hitem, adler, crc32);
            checksum = (int) (useCRC32 ? crc32.getValue() : adler.getValue());
            if (checksum != readHeaderItem(buf, 4, adler, crc32)) {
View Full Code Here

    // test methods of java.util.zip.getValue()
    Adler32 adl = new Adler32();
    assertEquals("GetValue should return a zero as a result of construction an object of Adler32",
        1, adl.getValue());

    adl.reset();
    adl.update(1);
    // System.out.print("value of adl"+adl.getValue());
    // The value of the adl should be 131074
    assertEquals("update(int) failed to update the checksum to the correct value ",
        131074, adl.getValue());
View Full Code Here

    adl.update(1);
    // System.out.print("value of adl"+adl.getValue());
    // The value of the adl should be 131074
    assertEquals("update(int) failed to update the checksum to the correct value ",
        131074, adl.getValue());
    adl.reset();
    assertEquals("reset failed to reset the checksum value to zero", 1, adl
        .getValue());

    adl.reset();
    adl.update(Integer.MIN_VALUE);
View Full Code Here

        131074, adl.getValue());
    adl.reset();
    assertEquals("reset failed to reset the checksum value to zero", 1, adl
        .getValue());

    adl.reset();
    adl.update(Integer.MIN_VALUE);
    // System.out.print("value of adl " + adl.getValue());
    // The value of the adl should be 65537
    assertEquals("update(min) failed to update the checksum to the correct value ",
        65537L, adl.getValue());
View Full Code Here

    adl.update(1);
    // The value of the adl should be 131074
    assertEquals("update(int) failed to update the checksum to the correct value ",
        131074, adl.getValue());

    adl.reset();
    adl.update(Integer.MAX_VALUE);
    // System.out.print("value of adl " + adl.getValue());
    // The value of the adl should be 16777472
    assertEquals("update(max) failed to update the checksum to the correct value ",
        16777472L, adl.getValue());
View Full Code Here

    // System.out.print("value of adl " + adl.getValue());
    // The value of the adl should be 16777472
    assertEquals("update(max) failed to update the checksum to the correct value ",
        16777472L, adl.getValue());

    adl.reset();
    adl.update(Integer.MIN_VALUE);
    // System.out.print("value of adl " + adl.getValue());
    // The value of the adl should be 65537
    assertEquals("update(min) failed to update the checksum to the correct value ",
        65537L, adl.getValue());
View Full Code Here

    // System.out.print("value of adl"+adl.getValue());
    // The value of the adl should be 393220
    assertEquals("update(byte[]) failed to update the checksum to the correct value ",
        393220, adl.getValue());

    adl.reset();
    byte byteEmpty[] = new byte[10000];
    adl.update(byteEmpty);
    // System.out.print("value of adl"+adl.getValue());
    // The value of the adl should be 655360001
    assertEquals("update(byte[]) failed to update the checksum to the correct value ",
View Full Code Here

    data.write(END_FRAME);
  }
 
  public static byte[] encodeChecksum(byte[] data) {
    Adler32 checksum = new Adler32();
    checksum.reset();
      checksum.update(data);
      return longToBytes(checksum.getValue());
  }
 
  private static byte[] longToBytes(long i) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.