Package java.util.zip

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


                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


        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

    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

                            }
                        });
                    }
                    byte[] bytes =  baos.toByteArray();
                    ze.setSize(bytes.length);
                    crc.reset();
                    crc.update(bytes);
                    ze.setCrc(crc.getValue());
                }

                outZip.putNextEntry(ze);
View Full Code Here

   
    Long ret = 0L;
    try {
      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

    private static void testArray(final StringBuffer buf) {
        final byte[] data = buf.toString().getBytes();

        final CRC32 inputChecksum = new CRC32();
        inputChecksum.reset();
        inputChecksum.update(data);

        // System.out.println(inputChecksum.getValue());
    }
View Full Code Here

        return data;
    }

    private static void checksumArray(final byte[] data) {
        final CRC32 inputChecksum = new CRC32();
        inputChecksum.reset();
        inputChecksum.update(data);

        // System.out.println(inputChecksum.getValue());
    }
View Full Code Here

                    final File file = Util.logFile(nextLogId);
                    if (file.exists() && server.getLogger().isWritten(nextLogId)) {
                        logId++;

                        output.writeByte(RECOVERY_LOG);
                        crc32.reset();
                        output.writeLong(logId);

                        LOG.info("sending recovery file: " + file.getName());
                        final BufferedInputStream fileInput = new BufferedInputStream(new FileInputStream(file));
View Full Code Here

            output.writeLong(lastId);
            do {
                if (input.readByte() != RECOVERY_LOG) {
                    return;
                }
                crc32.reset();
                final long logId = input.readLong();
                final File file = Util.tmpLogFile(logId);
                LOG.info("syncing recovery file: " + file.getName());
                final BufferedOutputStream fileOutput = new BufferedOutputStream(new FileOutputStream(file));
View Full Code Here

            slice.resetReaderIndex();
            crc32.update(array);

            return maskChecksum((int) crc32.getValue());
        } finally {
            crc32.reset();
        }
    }

    /**
     * From the spec:
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.