@Beta public final class Funnels extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
Funnels.ByteArrayFunnel |
private static class |
Funnels.IntegerFunnel |
private static class |
Funnels.LongFunnel |
private static class |
Funnels.SequentialFunnel<E> |
private static class |
Funnels.SinkAsStream |
private static class |
Funnels.StringCharsetFunnel |
private static class |
Funnels.UnencodedCharsFunnel |
Modifier | Constructor and Description |
---|---|
private |
Funnels() |
Modifier and Type | Method and Description |
---|---|
static java.io.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<java.lang.Integer> |
integerFunnel()
Returns a funnel for integers.
|
static Funnel<java.lang.Long> |
longFunnel()
Returns a funnel for longs.
|
static <E> Funnel<java.lang.Iterable<? 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 Funnel<java.lang.CharSequence> |
stringFunnel(java.nio.charset.Charset charset)
Returns a funnel that encodes the characters of a
CharSequence with the specified
Charset . |
static Funnel<java.lang.CharSequence> |
unencodedCharsFunnel()
Returns a funnel that extracts the characters from a
CharSequence , a character at a
time, without performing any encoding. |
public static Funnel<byte[]> byteArrayFunnel()
byte
array.public static Funnel<java.lang.CharSequence> unencodedCharsFunnel()
CharSequence
, a character at a
time, without performing any encoding. If you need to use a specific encoding, use stringFunnel(Charset)
instead.Funnels.stringFunnel()
.public static Funnel<java.lang.CharSequence> stringFunnel(java.nio.charset.Charset charset)
CharSequence
with the specified
Charset
.public static Funnel<java.lang.Integer> integerFunnel()
public static <E> Funnel<java.lang.Iterable<? extends E>> sequentialFunnel(Funnel<E> elementFunnel)
Iterable
by funneling its elements in iteration
order with the specified funnel. No separators are added between the elements.public static Funnel<java.lang.Long> longFunnel()
public static java.io.OutputStream asOutputStream(PrimitiveSink sink)
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
.