Package java.util.zip

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


   */
  public long getChecksum() {
    try {
      Adler32 checksum = new Adler32();
      InputStream is = openInputStream();
      checksum.update(ByteStreams.toByteArray(is));
      is.close();
      return checksum.getValue();
    } catch (IOException e) {
      return 0;
    }
View Full Code Here


      while(size != 0)
      {
        if ((readed = inStream.read(buf)) >= 0)
        {
          if (crc32 != null) crc32.update(buf, 0, readed);
          else if (adler32 != nulladler32.update(buf, 0, readed);
          else md.update(buf, 0, readed);
         
          assert size <= readed;
          size -= readed;
          if (listener != null)
View Full Code Here

        }

        return;
      }
      Checksum crc = new Adler32();
      crc.update(bytes, 0, bytes.length);
      if (crcValue != crc.getValue())
      {
        throw new IOException("CRC doesn't match " + crcValue + " vs "
            + crc.getValue());
      }
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

       * 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()));
      }
      classPrefix = "G"
          + Long.toString(checksum.getValue(), Character.MAX_RADIX);
    }

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

        }

        return;
      }
      Checksum crc = new Adler32();
      crc.update(bytes, 0, bytes.length);
      if (crcValue != crc.getValue()) {
        throw new IOException("CRC doesn't match " + crcValue + " vs " + crc.getValue());
      }
      InputArchive iab = BinaryInputArchive.getArchive(new ByteArrayInputStream(bytes));
      TxnHeader hdr = new TxnHeader();
View Full Code Here

     * as the basis for the hash code.
     */
    public int hashCode() {
        clear(); write();
        Adler32 code = new Adler32();
        code.update(getPointer().getByteArray(0, size()));
        return (int)code.getValue();
    }

    /** Cache native type information for use in native code. */
    protected void cacheTypeInfo(Pointer p) {
View Full Code Here

     * as the basis for the hash code.
     */
    public int hashCode() {
        clear(); write();
        Adler32 code = new Adler32();
        code.update(getPointer().getByteArray(0, size()));
        return (int)code.getValue();
    }

    /** Cache native type information for use in native code. */
    protected void cacheTypeInfo(Pointer p) {
View Full Code Here

                // factor in this case since we know
                // our write batches are going to much larger.
                Checksum checksum = new Adler32();
                for (PageWrite w : batch) {
                    try {
                        checksum.update(w.diskBound, 0, pageSize);
                    } catch (Throwable t) {
                        throw IOExceptionSupport.create(
                                "Cannot create recovery file. Reason: " + t, t);
                    }
                }
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.