Package com.google.common.hash
Class Funnels
java.lang.Object
com.google.common.hash.Funnels
Funnels for common types. All implementations are serializable.
- Since:
- 11.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumprivate static enumprivate static enumprivate static classprivate static classprivate static classprivate static enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OutputStreamasOutputStream(PrimitiveSink sink) Wraps aPrimitiveSinkas anOutputStream, so it is easy tofunnelan object to aPrimitiveSinkif 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 abytearray.Returns a funnel for integers.Returns a funnel for longs.sequentialFunnel(Funnel<E> elementFunnel) Returns a funnel that processes anIterableby funneling its elements in iteration order with the specified funnel.static Funnel<CharSequence>stringFunnel(Charset charset) Returns a funnel that encodes the characters of aCharSequencewith the specifiedCharset.static Funnel<CharSequence>Returns a funnel that extracts the characters from aCharSequence, a character at a time, without performing any encoding.
-
Constructor Details
-
Funnels
private Funnels()
-
-
Method Details
-
byteArrayFunnel
Returns a funnel that extracts the bytes from abytearray. -
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 aCharSequencewith the specifiedCharset.- Since:
- 15.0
-
integerFunnel
Returns a funnel for integers.- Since:
- 13.0
-
sequentialFunnel
Returns a funnel that processes anIterableby funneling its elements in iteration order with the specified funnel. No separators are added between the elements.- Since:
- 15.0
-
longFunnel
Returns a funnel for longs.- Since:
- 13.0
-
asOutputStream
Wraps aPrimitiveSinkas anOutputStream, so it is easy tofunnelan object to aPrimitiveSinkif there is already a way to write the contents of the object to anOutputStream.The
closeandflushmethods of the returnedOutputStreamdo nothing, and no method throwsIOException.- Since:
- 13.0
-