Examples of Adler32


Examples of java.util.zip.Adler32

            }

            byte data[] = new byte[size];
            reader.readFully(offset+BATCH_CONTROL_RECORD_SIZE, data);

            Checksum checksum = new Adler32();
            checksum.update(data, 0, data.length);

            if( expectedChecksum!=checksum.getValue() ) {
                return -1;
            }

        }
        return size;
View Full Code Here

Examples of java.util.zip.Adler32

                // Now we can fill in the batch control record properly.
                buff.reset();
                buff.skip(5+Journal.BATCH_CONTROL_RECORD_MAGIC.length);
                buff.writeInt(sequence.getLength()-Journal.BATCH_CONTROL_RECORD_SIZE);
                if( journal.isChecksum() ) {
                  Checksum checksum = new Adler32();
                  checksum.update(sequence.getData(), sequence.getOffset()+Journal.BATCH_CONTROL_RECORD_SIZE, sequence.getLength()-Journal.BATCH_CONTROL_RECORD_SIZE);
                  buff.writeLong(checksum.getValue());
                }

                // Now do the 1 big write.
                file.seek(wb.offset);
                if (maxStat > 0) {
View Full Code Here

Examples of java.util.zip.Adler32

        if (files.isEmpty())
            throw new BuildException("You must designate at least one file "
                    + "to include in the launch profile.");
        Collections.sort(files, FILENAME_SORTER);

        Checksum ck = new Adler32();
        for (File f : files)
            calcChecksum(f, ck);

        return Long.toString(Math.abs(ck.getValue()), Character.MAX_RADIX);
    }
View Full Code Here

Examples of java.util.zip.Adler32

        for (int i = 0; i < sortedNames.length; i++) {
            sortedNames[i] = resourceNames.get(i).toLowerCase();
        }
        Arrays.sort(sortedNames);

        Adler32 cksum = new Adler32();
        try {
            DataOutputStream out = new DataOutputStream(
                    new CheckedOutputStream(NULL_OUT, cksum));

            for (String resourceName : sortedNames) {
                long lastMod = collection.getLastModified(resourceName);
                if (lastMod < 1)
                    continue;

                Long checksum = collection.getChecksum(resourceName);
                if (checksum == null)
                    continue;

                out.writeUTF(resourceName);
                out.writeLong(checksum);
            }
        } catch (IOException e) {
            // can't happen
        }

        return cksum.getValue();
    }
View Full Code Here

Examples of java.util.zip.Adler32

                if (cksum != null)
                    return cksum;

                try {
                    // We don't have an up-to-date checksum. Calculate one.
                    Long newSum = FileUtils.computeChecksum(f, new Adler32());
                    // Save the new checksum. But don't return it yet! Start
                    // back at the top of the loop and make certain the last
                    // modified time hasn't changed since we calculated the
                    // checksum.
                    synchronized (this) {
View Full Code Here

Examples of java.util.zip.Adler32

        public AbortableOutputStream(File dest) throws IOException {
            this(new BufferedOutputStream(new FileOutputStream(dest)));
        }

        public AbortableOutputStream(OutputStream out) {
            super(out, new Adler32());
            this.aborted = false;
        }
View Full Code Here

Examples of java.util.zip.Adler32

        OutputStream outStream = new FileOutputStream(outFile);
        out = new CheckedOutputStream(outStream, checksum);
    }

    protected Checksum makeChecksum() {
        return new Adler32();
    }
View Full Code Here

Examples of java.util.zip.Adler32

     
      this.fileOutputStream = new FileOutputStream(file);
      this.fileChannel = this.fileOutputStream.getChannel();

      if (includeChecksum)
        checksum = new Adler32();
    }
View Full Code Here

Examples of java.util.zip.Adler32

  /**
   * Gets the checksum of a file
   */
  private void getFileChecksum(SolrParams solrParams, SolrQueryResponse rsp) {
    Checksum checksum = new Adler32();
    File dir = new File(core.getIndexDir());
    rsp.add(CHECKSUM, getCheckSums(solrParams.getParams(FILE), dir, checksum));
    dir = new File(core.getResourceLoader().getConfigDir());
    rsp.add(CONF_CHECKSUM, getCheckSums(solrParams.getParams(CONF_FILE_SHORT), dir, checksum));
  }
View Full Code Here

Examples of java.util.zip.Adler32

        String cf = nameAndAlias.getName(i);
        File f = new File(confDir, cf);
        if (!f.exists() || f.isDirectory()) continue; //must not happen
        FileInfo info = confFileInfoCache.get(cf);
        if (info == null || info.lastmodified != f.lastModified() || info.size != f.length()) {
          if (checksum == null) checksum = new Adler32();
          info = new FileInfo(f.lastModified(), cf, f.length(), getCheckSum(checksum, f));
          confFileInfoCache.put(cf, info);
        }
        Map<String, Object> m = info.getAsMap();
        if (nameAndAlias.getVal(i) != null) m.put(ALIAS, nameAndAlias.getVal(i));
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.