/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs while reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs while reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs while reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
public void testAsOutputStream() throws Exception { PrimitiveSink sink = mock(PrimitiveSink.class); OutputStream out = Funnels.asOutputStream(sink); byte[] bytes = {1, 2, 3, 4}; out.write(255); out.write(bytes); out.write(bytes, 1, 2); verify(sink).putByte((byte) 255); verify(sink).putBytes(bytes); verify(sink).putBytes(bytes, 1, 2); }
@Override public void funnel(Object from, PrimitiveSink into) { try (ObjectOutputStream out = new ObjectOutputStream(Funnels.asOutputStream(into))) { out.writeObject(from); } catch (IOException ex) { throw Throwables.propagate(ex); } } }
@Override public void funnel(Object from, PrimitiveSink into) { try (ObjectOutputStream out = new ObjectOutputStream(Funnels.asOutputStream(into))) { out.writeObject(from); } catch (IOException ex) { throw Throwables.propagate(ex); } } }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs in the process of reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs in the process of reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs in the process of reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs in the process of reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs in the process of reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs in the process of reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs while reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs in the process of reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
/** * Hashes the contents of this byte source using the given hash function. * * @throws IOException if an I/O error occurs while reading from this source */ public HashCode hash(HashFunction hashFunction) throws IOException { Hasher hasher = hashFunction.newHasher(); copyTo(Funnels.asOutputStream(hasher)); return hasher.hash(); }
Hasher hasher = Hashing.sha1().newHasher(); try (InputStream in = jar.getInputStream(entry)) { ByteStreams.copy(in, Funnels.asOutputStream(hasher));
Hasher hasher = Hashing.sha1().newHasher(); try (InputStream in = jar.getInputStream(entry)) { ByteStreams.copy(in, Funnels.asOutputStream(hasher));
public void testAsOutputStream() throws Exception { PrimitiveSink sink = mock(PrimitiveSink.class); OutputStream out = Funnels.asOutputStream(sink); byte[] bytes = { 1, 2, 3, 4 }; out.write(255); out.write(bytes); out.write(bytes, 1, 2); verify(sink).putByte((byte) 255); verify(sink).putBytes(bytes); verify(sink).putBytes(bytes, 1, 2); }
GeometryFunnel.funnel((Geometry) value, into); } else if (value instanceof Serializable) { OutputStream byteOutput = Funnels.asOutputStream(into); try { ObjectOutput objectOut = new ObjectOutputStream(byteOutput);