Package java.util.zip

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


        ze.setMethod(method);
        ze.setSize(bytes.length);

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

        ze.setTime(System.currentTimeMillis());
View Full Code Here


        ze.setMethod(method);
        ze.setSize(bytes.length);

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

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

                zipEntry.setMethod(ze.getMethod());
                zipEntry.setSize(xmlBytes.length);

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

                zipEntry.setTime(System.currentTimeMillis());
View Full Code Here

       
        if ( bytesRead < crcSize ) {
          continue;
        }
       
        crc32.reset();
        crc32.update(buf, 0, crcSize);
        long crc = crc32.getValue();

        for(int j=0; j<numBufs+1; j++) {
          if ( j < numBufs && crc != bufInfoArr[j].crc32 ) {
View Full Code Here

                zipEntry.setMethod(ze.getMethod());
                zipEntry.setSize(xmlBytes.length);

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

                zipEntry.setTime(System.currentTimeMillis());
View Full Code Here

       
        if ( bytesRead < crcSize ) {
          continue;
        }
       
        crc32.reset();
        crc32.update(buf, 0, crcSize);
        long crc = crc32.getValue();

        for(int j=0; j<numBufs+1; j++) {
          if ( j < numBufs && crc != bufInfoArr[j].crc32 ) {
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

      InputStream in = new FileInputStream(srcFile);
      OutputStream out = new FileOutputStream(destFile);

      //TODO use a better checksumming algorithm like SHA-1
      CRC32 checksum = new CRC32();
      checksum.reset();

      byte[] buffer = new byte[bufferSize];
      int bytesRead;
      while ((bytesRead = in.read(buffer)) >= 0) {
View Full Code Here

   }

   public static Long createChecksum(File file) throws IOException {
      InputStream in = new FileInputStream(file);
      CRC32 checksum = new CRC32();
      checksum.reset();
      byte[] buffer = new byte[bufferSize];
      int bytesRead;
      while ((bytesRead = in.read(buffer)) >= 0) {
         checksum.update(buffer, 0, bytesRead);
      }
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.