Package java.util.zip

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


    header.write(8); // depth
    header.write(2); // direct model
    header.write(0); // compression
    header.write(0); // no filter
    header.write(0); // no interlace
    crc.reset();
    crc.update(header.toByteArray());
    out.write(header.toByteArray());
    writeUnsignedInt(out, crc.getValue());

    Deflater deflator = new Deflater(5);
View Full Code Here


    zipStream.close();

    byte[] zippedBytes = zippedByteStream.toByteArray();
    writeUnsignedInt(out, zippedBytes.length);
    out.write(IDAT);
    crc.reset();
    crc.update(IDAT);
    out.write(zippedBytes);
    crc.update(zippedBytes);
    writeUnsignedInt(out, crc.getValue());
    deflator.finish();
View Full Code Here

    writeUnsignedInt(out, crc.getValue());
    deflator.finish();

    writeUnsignedInt(out, 0);
    out.write(IEND);
    crc.reset();
    crc.update(IEND);
    writeUnsignedInt(out, crc.getValue());

    return out.toByteArray();
  }
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

        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

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