Package java.util.zip

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


                        // 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


            Integer.toHexString(hitem) + ")");
      }
      if (extraField) { // lzop 1.08 ultimately ignores this
        LOG.debug("Extra header field not processed");
        adler.reset();
        crc32.reset();
        hitem = readHeaderItem(in, buf, 4, adler, crc32);
        readHeaderItem(in, new byte[hitem], hitem, adler, crc32);
        checksum = (int)(useCRC32 ? crc32.getValue() : adler.getValue());
        if (checksum != readHeaderItem(in, buf, 4, adler, crc32)) {
          throw new IOException("Invalid checksum for extra header field");
View Full Code Here

                break;
            }

            CRC32 cs = new CRC32();

            cs.reset();
            cs.update(b200);
            assertEquals("Incorrect checksum value", 3061553656L, cs.getValue());
            count = 200;
            for (; is.read() != -1; count++) {
            }
View Full Code Here

                    break;
                }

                cs = new CRC32();

                cs.reset();
                cs.update(b200);
                assertEquals("Incorrect checksum value", 3061553656L, cs
                        .getValue());
                assertEquals(3470, rs.getInt(2));
                try {
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

        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

        // start header
        final ByteArrayOutputStream startHeaderBaos = new ByteArrayOutputStream();
        final DataOutputStream startHeaderStream = new DataOutputStream(startHeaderBaos);
        startHeaderStream.writeLong(Long.reverseBytes(headerPosition - SevenZFile.SIGNATURE_HEADER_SIZE));
        startHeaderStream.writeLong(Long.reverseBytes(0xffffFFFFL & headerBytes.length));
        crc32.reset();
        crc32.update(headerBytes);
        startHeaderStream.writeInt(Integer.reverseBytes((int)crc32.getValue()));
        startHeaderStream.flush();
        final byte[] startHeaderBytes = startHeaderBaos.toByteArray();
        crc32.reset();
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.