Package java.util.zip

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


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

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

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


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

        // System.out.println(inputChecksum.getValue());
    }
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

                        // writeUTF/writeWithShortLength) and 4 bytes for column count.
                        // This prevents CRC by being fooled by special-case garbage in the file; see CASSANDRA-2128
                        if (serializedSize < 10)
                            break;
                        long claimedSizeChecksum = reader.readLong();
                        checksum.reset();
                        checksum.update(serializedSize);
                        if (checksum.getValue() != claimedSizeChecksum)
                            break; // entry wasn't synced correctly/fully.  that's ok.

                        if (serializedSize > bytes.length)
View Full Code Here

                    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());
                        BufferedInputStream fileInput = new BufferedInputStream(new FileInputStream(file));
View Full Code Here

            output.writeLong(lastId);
            do {
                if (input.readByte() != RECOVERY_LOG) {
                    return;
                }
                crc32.reset();
                long logId = input.readLong();
                File file = Util.tmpLogFile(logId);
                LOG.info("syncing recovery file: " + file.getName());
                BufferedOutputStream fileOutput = new BufferedOutputStream(new FileOutputStream(file));
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

                        // writeUTF/writeWithShortLength) and 4 bytes for column count.
                        // This prevents CRC by being fooled by special-case garbage in the file; see CASSANDRA-2128
                        if (serializedSize < 10)
                            break;
                        long claimedSizeChecksum = reader.readLong();
                        checksum.reset();
                        checksum.update(serializedSize);
                        if (checksum.getValue() != claimedSizeChecksum)
                            break; // entry wasn't synced correctly/fully.  that's ok.

                        if (serializedSize > bytes.length)
View Full Code Here

                        // writeUTF/writeWithShortLength) and 4 bytes for column count.
                        // This prevents CRC by being fooled by special-case garbage in the file; see CASSANDRA-2128
                        if (serializedSize < 10)
                            break;
                        long claimedSizeChecksum = reader.readLong();
                        checksum.reset();
                        checksum.update(serializedSize);
                        if (checksum.getValue() != claimedSizeChecksum)
                            break; // entry wasn't synced correctly/fully.  that's ok.

                        if (serializedSize > bytes.length)
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.