> +         HashingInputStream linearHis = new 
> HashingInputStream(Hashing.sha256(), is);
> +         while (true) {
> +             HashingInputStream chunkedHis = new HashingInputStream(
> +                     Hashing.sha256(), ByteStreams.limit(linearHis, 
> CHUNK_SIZE));
> +             long count = ByteStreams.copy(chunkedHis, 
> ByteStreams.nullOutputStream());
> +             if (count == 0) {
> +                 break;
> +             }
> +             q.offer(chunkedHis.hash());
> +         }
> +
> +         //Rehash the queue until its size is 1.
> +         while (q.size() > 1)
> +            q = hashQueue(q);
> +
> +         this.treeHash = q.poll();

Use `remove()` here? We want to fail if the queue is actually empty for some 
weird reason, I guess? And perhaps add a comment "// hashedQueue should contain 
exactly one element now" or so?

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

Reply via email to