Class Funnels
java.lang.Object
com.google.common.hash.Funnels
-
Method Summary
Modifier and TypeMethodDescriptionstatic OutputStream
asOutputStream
(PrimitiveSink sink) Wraps aPrimitiveSink
as anOutputStream
, so it is easy tofunnel
an object to aPrimitiveSink
if there is already a way to write the contents of the object to anOutputStream
.static Funnel
<byte[]> Returns a funnel that extracts the bytes from abyte
array.Returns a funnel for integers.Returns a funnel for longs.sequentialFunnel
(Funnel<E> elementFunnel) Returns a funnel that processes anIterable
by funneling its elements in iteration order with the specified funnel.static Funnel
<CharSequence> stringFunnel
(Charset charset) Returns a funnel that encodes the characters of aCharSequence
with the specifiedCharset
.static Funnel
<CharSequence> Returns a funnel that extracts the characters from aCharSequence
, a character at a time, without performing any encoding.
-
Method Details
-
byteArrayFunnel
Returns a funnel that extracts the bytes from abyte
array. -
unencodedCharsFunnel
Returns a funnel that extracts the characters from aCharSequence
, a character at a time, without performing any encoding. If you need to use a specific encoding, usestringFunnel(Charset)
instead.- Since:
- 15.0 (since 11.0 as
Funnels.stringFunnel()
.
-
stringFunnel
Returns a funnel that encodes the characters of aCharSequence
with the specifiedCharset
.- Since:
- 15.0
-
integerFunnel
-
sequentialFunnel
-
longFunnel
-
asOutputStream
Wraps aPrimitiveSink
as anOutputStream
, so it is easy tofunnel
an object to aPrimitiveSink
if there is already a way to write the contents of the object to anOutputStream
.The
close
andflush
methods of the returnedOutputStream
do nothing, and no method throwsIOException
.- Since:
- 13.0
-