> +      Queue<HashCode> q = Lists.newLinkedList();
> +
> +      //Divide the payload in chunks and queue them.
> +      byte[] buffer = new byte[CHUNK_SIZE];
> +      int bytesRead;
> +      while ((bytesRead = is.read(buffer)) >= 0) {
> +         q.offer(Hashing.sha256().hashBytes(buffer, 0, bytesRead));
> +         hasher.putBytes(buffer, 0, bytesRead);
> +      }
> +
> +      //Rehash the queue until its size is 1.
> +      while (q.size() > 1)
> +         q = hashQueue(q);
> +
> +      this.treeHash = q.poll().toString();
> +      this.hash = hasher.hash().toString();

Can you keep this as a `HashCode` for type-safety?  The ultimate consumer can 
transform it into a `String` when needed.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/9/files#r13771532

Reply via email to