public Collection generateSums(InputStream in) throws IOException { Collection sums = null; byte[] buf = new byte[config.blockLength*config.blockLength]; long offset = 0; int len = 0;  while ((len = in.read(buf)) != -1) { if (sums == null) { sums = generateSums(buf, 0, len, offset); } else { sums.addAll(generateSums(buf, 0, len, offset)); } offset += len; }  return sums;
public Collection generateSums(byte[] buf) { return generateSums(buf, 0, buf.length, 0);
   public Collection generateSums(InputStream in) throws IOException {      Collection sums = null;      byte[] buf = new byte[config.blockLength*config.blockLength];      long offset = 0;      int len = 0;      while ((len = in.read(buf)) != -1) {         if (sums == null) {            sums = generateSums(buf, 0, len, offset);         } else {            sums.addAll(generateSums(buf, 0, len, offset));         }         offset += len;      }      return sums;   }