@Test public void hashZero() throws Exception { List<HashAlgorithm> zeroAlgorithms = ImmutableList.of(); Map<HashAlgorithm, HashCode> hashes = Hashes.hash(zeroAlgorithms, inputStream()); assertThat(hashes.size(), is(0)); }
public static HashCode hash(final HashAlgorithm algorithm, final InputStream inputStream) throws IOException { checkNotNull(algorithm); checkNotNull(inputStream); try (HashingInputStream hashingStream = new HashingInputStream(algorithm.function(), inputStream)) { ByteStreams.copy(hashingStream, ByteStreams.nullOutputStream()); return hashingStream.hash(); } }
Hashes { public static HashCode hash(final HashAlgorithm algorithm, final InputStream inputStream) throws IOException { checkNotNull(algorithm); checkNotNull(inputStream); try (HashingInputStream hashingStream = new HashingInputStream(algorithm.function(), inputStream)) { ByteStreams.copy(hashingStream, ByteStreams.nullOutputStream()); return hashingStream.hash(); } } }
Hashes { public static HashCode hash(final HashAlgorithm algorithm, final InputStream inputStream) throws IOException { checkNotNull(algorithm); checkNotNull(inputStream); try (HashingInputStream hashingStream = new HashingInputStream(algorithm.function(), inputStream)) { ByteStreams.copy(hashingStream, ByteStreams.nullOutputStream()); return hashingStream.hash(); } } private  Hashes(); }
Hashes { public static HashCode hash(final HashAlgorithm algorithm, final InputStream inputStream) throws IOException { checkNotNull(algorithm); checkNotNull(inputStream); try (HashingInputStream hashingStream = new HashingInputStream(algorithm.function(), inputStream)) { ByteStreams.copy(hashingStream, ByteStreams.nullOutputStream()); return hashingStream.hash(); } } private  Hashes(); static HashCode hash(final HashAlgorithm algorithm, final InputStream inputStream); static Map<HashAlgorithm, HashCode> hash(final Iterable<HashAlgorithm> algorithms,
                                                  final InputStream inputStream); static HashCode hash(final HashFunction function, final InputStream input); }
Hashes { public static HashCode hash(final HashAlgorithm algorithm, final InputStream inputStream) throws IOException { checkNotNull(algorithm); checkNotNull(inputStream); try (HashingInputStream hashingStream = new HashingInputStream(algorithm.function(), inputStream)) { ByteStreams.copy(hashingStream, ByteStreams.nullOutputStream()); return hashingStream.hash(); } } private  Hashes(); static HashCode hash(final HashAlgorithm algorithm, final InputStream inputStream); static Map<HashAlgorithm, HashCode> hash(final Iterable<HashAlgorithm> algorithms,
                                                  final InputStream inputStream); static HashCode hash(final HashFunction function, final InputStream input);  }