com.google.common.hash
Class Funnels

java.lang.Object
  extended by com.google.common.hash.Funnels

@Beta
public final class Funnels
extends Object

Funnels for common types. All implementations are serializable.

Since:
11.0
Author:
Dimitris Andreou

Method Summary
static OutputStream asOutputStream(PrimitiveSink sink)
          Wraps a PrimitiveSink as an OutputStream, so it is easy to funnel an object to a PrimitiveSink if there is already a way to write the contents of the object to an OutputStream.
static Funnel<byte[]> byteArrayFunnel()
          Returns a funnel that extracts the bytes from a byte array.
static Funnel<Integer> integerFunnel()
          Returns a funnel for integers.
static Funnel<Long> longFunnel()
          Returns a funnel for longs.
static Funnel<CharSequence> stringFunnel()
          Returns a funnel that extracts the characters from a CharSequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

byteArrayFunnel

public static Funnel<byte[]> byteArrayFunnel()
Returns a funnel that extracts the bytes from a byte array.


stringFunnel

public static Funnel<CharSequence> stringFunnel()
Returns a funnel that extracts the characters from a CharSequence.


integerFunnel

public static Funnel<Integer> integerFunnel()
Returns a funnel for integers.

Since:
13.0

longFunnel

public static Funnel<Long> longFunnel()
Returns a funnel for longs.

Since:
13.0

asOutputStream

public static OutputStream asOutputStream(PrimitiveSink sink)
Wraps a PrimitiveSink as an OutputStream, so it is easy to funnel an object to a PrimitiveSink if there is already a way to write the contents of the object to an OutputStream.

The close and flush methods of the returned OutputStream do nothing, and no method throws IOException.

Since:
13.0


Copyright © 2010-2012. All Rights Reserved.