Package java.util.zip

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


    defl.setDictionary(dictionaryArray);
    deflAdler = defl.getAdler();

    // getting the checkSum value through the Adler32 class
    Adler32 adl = new Adler32();
    adl.update(dictionaryArray);
    long realAdler = adl.getValue();
        assertEquals(deflAdler, realAdler);

    defl.setInput(byteArray);
    defl.finish();
View Full Code Here


    while (!defl.finished()) {
            defl.deflate(outPutBuf);
        }
    deflAdler = defl.getAdler();
    adl = new Adler32();
    adl.update(byteArray);
    realAdler = adl.getValue();
    // Deflate is finished and there were bytes deflated that did not occur
    // in the dictionaryArray, therefore a new dictionary was automatically
    // set.
        assertEquals(realAdler, deflAdler);
View Full Code Here

    defl.setDictionary(dictionaryArray, offSet, length);
    deflAdler = defl.getAdler();

    // getting the checkSum value through the Adler32 class
    Adler32 adl = new Adler32();
    adl.update(dictionaryArray, offSet, length);
    long realAdler = adl.getValue();
        assertEquals(deflAdler, realAdler);

    defl.setInput(byteArray);
    while (!defl.needsInput()) {
View Full Code Here

    while (!defl.needsInput()) {
            defl.deflate(outPutBuf);
        }
    deflAdler = defl.getAdler();
    adl = new Adler32();
    adl.update(byteArray);
    realAdler = adl.getValue();
    // Deflate is finished and there were bytes deflated that did not occur
    // in the dictionaryArray, therefore a new dictionary was automatically
    // set.
        assertEquals(realAdler, deflAdler);
View Full Code Here

    Inflater inflateDiction = new Inflater();
    inflateDiction.setInput(outPutDiction);
    if (inflateDiction.needsDictionary() == true) {
      // getting the checkSum value through the Adler32 class
      Adler32 adl = new Adler32();
      adl.update(dictionaryArray);
      long checkSumR = adl.getValue();
      assertTrue(
          "the checksum value returned by getAdler() is not the same as the checksum returned by creating the adler32 instance",
          checkSumR == inflateDiction.getAdler());
    }
View Full Code Here

     * arbitrarily long amount of time to return a good value.
     */
    String conflict = stringStartsWithAny(obfuscatedClassName, reservedPrefixes);
    while (conflict != null) {
      Adler32 hash = new Adler32();
      hash.update(Util.getBytes(conflict));
      /*
       * Compute a new prefix for the identifier to mask the prefix and add the
       * reserved identifier character to prevent conflicts with makeIdent().
       *
       * Assuming "gwt-" is a reserved prefix: gwt-A -> ab32ZA
View Full Code Here

       * Note that the checksum will miss some or all of the subtypes generated
       * by other generators.
       */
      Adler32 checksum = new Adler32();
      for (JClassType type : cssResourceSubtypes) {
        checksum.update(Util.getBytes(type.getQualifiedSourceName()));
      }

      final int seed = Math.abs((int) checksum.getValue());
      classPrefix = "G" + computeObfuscatedClassName("", new Counter() {
        @Override
View Full Code Here

    SortedSet<JClassType> gssResources = computeOperableTypes(context);

    Adler32 checksum = new Adler32();

    for (JClassType type : gssResources) {
      checksum.update(Util.getBytes(type.getQualifiedSourceName()));
    }

    int seed = Math.abs((int) checksum.getValue());

    return encode(seed) + "-";
View Full Code Here

                long expectedChecksum = currentBatchBuffer.getLong();
                Checksum actualChecksum = new Adler32();
                Location nextLocation = goToNextLocation(currentBatch, Location.ANY_RECORD_TYPE, true);
                while (nextLocation != null && nextLocation.getType() != Location.BATCH_CONTROL_RECORD_TYPE) {
                    byte data[] = accessor.readLocation(nextLocation, false);
                    actualChecksum.update(data, 0, data.length);
                    nextLocation = goToNextLocation(nextLocation, Location.ANY_RECORD_TYPE, true);
                }
                if (expectedChecksum != actualChecksum.getValue()) {
                    throw new IOException("Bad checksum for location: " + currentBatch);
                }
View Full Code Here

                buffer.putInt(current.location.getPointer());
                buffer.putInt(current.location.getSize());
                buffer.put(current.location.getType());
                buffer.put(current.getData());
                if (checksum) {
                    adler32.update(current.getData(), 0, current.getData().length);
                }
            }

            // Now we can fill in the batch control record properly.
            buffer.position(Journal.HEADER_SIZE);
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.