Package java.util.zip

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


    } catch (Throwable thr) {
      throw new RegainException( thr.getMessage(), thr );
   
    CRC32 crc = new CRC32();
    crc.update(bytearrayMessage);
   
    mLog.debug("loadIMAPMessage crc: " + crc.getValue() + " for IMAP url: " + url);
    return bytearrayMessage;
  }
 
View Full Code Here


      fis = new FileInputStream(f);
      int len = 0;
      byte[] buffer = new byte[DISK_DATA_BUFFER_SIZE];
      while ((len = fis.read(buffer)) != -1)
      {
        result.update(buffer, 0, len);
      }
    }
    finally
    {
      closeInputStream(fis);
View Full Code Here

            ZipEntry ze = new ZipEntry("mimetype");
            String mime = "application/vnd.oasis.opendocument.spreadsheet";
            ze.setMethod(ZipEntry.STORED);
            ze.setSize(mime.length());
            CRC32 crc = new CRC32();
            crc.update(mime.getBytes());
            ze.setCrc(crc.getValue());
            out.putNextEntry(ze);
            for (int i=0; i<mime.length(); i++) {
                out.write(mime.charAt(i));
            }
View Full Code Here

      boolean bAbort = false;
      while(size != 0)
      {
        if ((readed = inStream.read(buf)) >= 0)
        {
          if (crc32 != null) crc32.update(buf, 0, readed);
          else if (adler32 != nulladler32.update(buf, 0, readed);
          else md.update(buf, 0, readed);
         
          assert size <= readed;
          size -= readed;
View Full Code Here

        for (;;) {
            int read = in.read(buf);
            if (read == -1)
                break;
            sum.update(buf, 0, read);
        }
        in.close();
        return sum.getValue();
    }
View Full Code Here

            {
                assert serializedRow instanceof byte[];
                bytes = (byte[]) serializedRow;
            }

            checksum.update(bytes.length);
            logWriter.writeInt(bytes.length);
            logWriter.writeLong(checksum.getValue());
            logWriter.write(bytes);
            checksum.update(bytes, 0, bytes.length);
            logWriter.writeLong(checksum.getValue());
View Full Code Here

            checksum.update(bytes.length);
            logWriter.writeInt(bytes.length);
            logWriter.writeLong(checksum.getValue());
            logWriter.write(bytes);
            checksum.update(bytes, 0, bytes.length);
            logWriter.writeLong(checksum.getValue());

            return cLogCtx;
        }
        catch (IOException e)
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.update(serializedSize);
                        if (checksum.getValue() != claimedSizeChecksum)
                            break; // entry wasn't synced correctly/fully.  that's ok.

                        if (serializedSize > bytes.length)
                            bytes = new byte[(int) (1.2 * serializedSize)];
 
View Full Code Here

        {
            Checksum checksum = new CRC32();

            // write the first checksum after the fixed-size part, so we won't read garbage lastFlushedAt data.
            dos.writeInt(clHeader.cfDirtiedAt.size()); // 4
            checksum.update(clHeader.cfDirtiedAt.size());
            dos.writeLong(checksum.getValue());

            // write the 2nd checksum after the lastflushedat map
            for (Map.Entry<Integer, Integer> entry : clHeader.cfDirtiedAt.entrySet())
            {
View Full Code Here

            // write the 2nd checksum after the lastflushedat map
            for (Map.Entry<Integer, Integer> entry : clHeader.cfDirtiedAt.entrySet())
            {
                dos.writeInt(entry.getKey()); // 4
                checksum.update(entry.getKey());
                dos.writeInt(entry.getValue()); // 4
                checksum.update(entry.getValue());
            }
            dos.writeLong(checksum.getValue());
        }
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.