Class Funnels


  • @Beta
    public final class Funnels
    extends 
    Funnels for common types. All implementations are serializable.
    Since:
    11.0
    Author:
    Dimitris Andreou
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static asOutputStream​(PrimitiveSink sink)
      Wraps a PrimitiveSink as an , 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 > integerFunnel()
      Returns a funnel for integers.
      static > longFunnel()
      Returns a funnel for longs.
      static <E> <? extends E>> sequentialFunnel​(Funnel<E> elementFunnel)
      Returns a funnel that processes an Iterable by funneling its elements in iteration order with the specified funnel.
      static >  charset)
      Returns a funnel that encodes the characters of a CharSequence with the specified Charset.
      static > unencodedCharsFunnel()
      Returns a funnel that extracts the characters from a CharSequence, a character at a time, without performing any encoding.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Method Detail

      • byteArrayFunnel

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

        public static > unencodedCharsFunnel()
        Returns a funnel that extracts the characters from a CharSequence, a character at a time, without performing any encoding. If you need to use a specific encoding, use stringFunnel(Charset) instead.
        Since:
        15.0 (since 11.0 as Funnels.stringFunnel().
      • stringFunnel

        public static >  charset)
        Returns a funnel that encodes the characters of a CharSequence with the specified Charset.
        Since:
        15.0
      • integerFunnel

        public static > integerFunnel()
        Returns a funnel for integers.
        Since:
        13.0
      • sequentialFunnel

        public static <E> <? extends E>> sequentialFunnel​(Funnel<E> elementFunnel)
        Returns a funnel that processes an Iterable by funneling its elements in iteration order with the specified funnel. No separators are added between the elements.
        Since:
        15.0
      • longFunnel

        public static > longFunnel()
        Returns a funnel for longs.
        Since:
        13.0
      • asOutputStream

        public static  asOutputStream​(PrimitiveSink sink)
        Wraps a PrimitiveSink as an , 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