Package java.util.zip

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


        crc32.reset();
        crc32.update(headerBytes);
        startHeaderStream.writeInt(Integer.reverseBytes((int)crc32.getValue()));
        startHeaderStream.flush();
        final byte[] startHeaderBytes = startHeaderBaos.toByteArray();
        crc32.reset();
        crc32.update(startHeaderBytes);
        file.writeInt(Integer.reverseBytes((int) crc32.getValue()));
        file.write(startHeaderBytes);
    }
   
View Full Code Here


            break;
          }

          CRC32 cs = new CRC32();

          cs.reset();
          cs.update(b200);

          System.out.println("Checksum of first 200 bytes " + cs.getValue());

          count = 200;
View Full Code Here

            break;
          }

          CRC32 cs = new CRC32();

          cs.reset();
          cs.update(b200);

          System.out.println("Checksum of first 200 bytes " + cs.getValue());

          System.out.println("second columns is " + rs.getInt(2));
View Full Code Here

      ps.setInt(1, i); // ID
      byte[] dataBytes  = generateBinaryData(r, 90000 , 1000 * i);
      ps.setBytes(2, dataBytes);
      //calculate checksum for blob data
      checksum.update(dataBytes, 0, dataBytes.length);
      checksum.reset();
      checksum.update(dataBytes, 0, dataBytes.length);
      ps.setLong(3, checksum.getValue());
      ps.executeUpdate();
      conn.commit();
    }
View Full Code Here

      byte[] dataBytes  = generateBinaryData(r, 1234 , 5000 * i);
      ps.setBytes(1, dataBytes);

      // calculate checksum for blob data
      checksum.update(dataBytes, 0, dataBytes.length);
      checksum.reset();
      checksum.update(dataBytes, 0, dataBytes.length);

      ps.setLong(2, checksum.getValue());
      ps.setInt(3, i); // ID
      updateCount +=  ps.executeUpdate();
View Full Code Here

    {
      byte[] dataBytes = rs.getBytes(1);
      long ckmRead = rs.getLong(2);
      int id = rs.getInt(3);

      checksum.reset();
      checksum.update(dataBytes, 0, dataBytes.length);

      if(checksum.getValue() != ckmRead )
      {
        logMessage("CHECKSUMs ARE NOT MATCHING");
View Full Code Here

      return;
    }

    // normal case, just an update the checksum.
    CRC32 chk = new CRC32();
    chk.reset();
    chk.update(e.getBody());
    long chkVal = chk.getValue();

    if (chkVal != ByteBuffer.wrap(bchk).getLong()) {
      LOG.warn("check sum does not match!");
View Full Code Here

    if (onDiskChecksum != checksum.getValue())
    {
      // try again using new checksum object to be doubly sure
      CRC32 newChecksum = new CRC32();
      newChecksum.reset();
      newChecksum.update(pageData, 0, getPageSize()-CHECKSUM_SIZE);
      if (onDiskChecksum != newChecksum.getValue())
      {
        throw StandardException.newException(
                    SQLState.FILE_BAD_CHECKSUM,
View Full Code Here

        if (onDiskChecksum != checksum.getValue())
        {
            // try again using new checksum object to be doubly sure
            CRC32 newChecksum = new CRC32();
            newChecksum.reset();
            newChecksum.update(pageData, 0, getPageSize()-CHECKSUM_SIZE);
            if (onDiskChecksum != newChecksum.getValue())
            {
                throw StandardException.newException(
                    SQLState.FILE_BAD_CHECKSUM,
View Full Code Here

            ZipEntry ze = new ZipEntry(XMLFILE);
            ze.setSize(xmlBytes.length);

            CRC32 crc = new CRC32();
            crc.reset();
            crc.update(xmlBytes);
            ze.setCrc(crc.getValue());

            ze.setTime(System.currentTimeMillis());
            ze.setMethod(ZipEntry.DEFLATED);
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.