示例#1
0
 public void fingerprintFiles(List<String> paths, Polynomial p)
     throws FileNotFoundException, IOException {
   final RabinFingerprintLong rabin = new RabinFingerprintLong(p);
   for (String path : paths) {
     File file = new File(path);
     if (file.exists()) {
       rabin.reset();
       rabin.pushBytes(ByteStreams.toByteArray(new FileInputStream(file)));
       System.out.println(
           String.format("%X %s", rabin.getFingerprintLong(), file.getAbsolutePath()));
       System.out.flush();
     } else {
       System.err.print(String.format("Could not find file %s", path));
       System.err.flush();
     }
   }
 }
示例#2
0
 /** Rapidly fingerprint an entire stream's contents. */
 public long getFullFingerprint(InputStream is) throws IOException {
   final RabinFingerprintLong finger = newFingerprint();
   finger.pushBytes(ByteStreams.toByteArray(is));
   return finger.getFingerprintLong();
 }
示例#3
0
 public void fingerprintStdin(Polynomial p) throws IOException {
   final RabinFingerprintLong rabin = new RabinFingerprintLong(p);
   rabin.pushBytes(ByteStreams.toByteArray(System.in));
   System.out.println(String.format("%X", rabin.getFingerprintLong()));
 }