|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.lang.protocol.ConsumerUtil
public final class ConsumerUtil
Various Consumer-related utility methods.
| Method Summary | ||
|---|---|---|
static
|
addToCollection(java.util.Collection<T> drain)
|
|
static
|
asConsumer(ConsumerWhichThrows<? super T,? extends java.lang.RuntimeException> delegate)
Converts a {@link ConsumerWhichThrows ConsumerWhichThrows |
|
static
|
asConsumerWhichThrows(Consumer<T> delegate)
Converts a {@link Consumer Consumer |
|
static java.io.Writer |
characterConsumerWriter(ConsumerWhichThrows<java.lang.Character,java.io.IOException> delegate)
|
|
static
|
combine(Consumer<T> target)
The returned producer is a factory for consumers of T. |
|
static
|
combineInOrder(ConsumerWhichThrows<T,EX> target)
The returned producer is a factory for consumers of T. |
|
static
|
lineAggregator(ConsumerWhichThrows<java.lang.String,E> delegate)
|
|
static ConsumerWhichThrows<java.lang.String,java.io.IOException> |
lineConsumer(java.io.File file,
boolean append)
|
|
static ConsumerWhichThrows<java.lang.String,java.io.IOException> |
lineConsumer(java.io.File file,
java.lang.String charsetName,
boolean append)
|
|
static Consumer<java.lang.String> |
lineConsumer(java.io.PrintStream printStream,
boolean closeOnFinalize)
|
|
static ConsumerWhichThrows<java.lang.String,java.io.IOException> |
lineConsumer(java.io.Writer writer,
boolean closeOnFinalize)
|
|
static
|
splice(int n,
ConsumerWhichThrows<java.util.List<T>,EX> target)
Returns a list of consumers of size n. |
|
static
|
tee(java.util.Collection<ConsumerWhichThrows<T,EX>> delegates)
|
|
static
|
tee(ConsumerWhichThrows<T,EX> delegate1,
ConsumerWhichThrows<T,EX> delegate2)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T,EX extends java.lang.Exception> ConsumerWhichThrows<T,EX> tee(ConsumerWhichThrows<T,EX> delegate1,
ConsumerWhichThrows<T,EX> delegate2)
delegate1 and delegate2public static <T,EX extends java.lang.Exception> ConsumerWhichThrows<T,EX> tee(java.util.Collection<ConsumerWhichThrows<T,EX>> delegates)
delegatespublic static <T,EX extends java.lang.Exception> ConsumerWhichThrows<T,EX> asConsumerWhichThrows(Consumer<T> delegate)
Consumer super T> (the "source") into a ConsumerWhichThrows (the "target"), which is always possible.
T - The element typeEX - The target consumer's exceptionpublic static <T,EX extends java.lang.RuntimeException> Consumer<T> asConsumer(ConsumerWhichThrows<? super T,? extends java.lang.RuntimeException> delegate)
ConsumerWhichThrows super T, ? extends RuntimeException (the "source")
into a Consumer (the "target"), which is always possible.
of the source's element type.
T - The element typeEX - The source consumer's exceptionpublic static java.io.Writer characterConsumerWriter(ConsumerWhichThrows<java.lang.Character,java.io.IOException> delegate)
Writer which forwards the characters to a ConsumerWhichThrows<Character, IOException>public static <E extends java.lang.Exception> ConsumerWhichThrows<java.lang.Character,E> lineAggregator(ConsumerWhichThrows<java.lang.String,E> delegate)
Consumer<Character> which aggregates characters to lines, which it passes to the
delegate
public static ConsumerWhichThrows<java.lang.String,java.io.IOException> lineConsumer(java.io.File file,
boolean append)
throws java.io.IOException
Consumer that writes lines to the given file with the default character encoding
java.io.IOException
public static ConsumerWhichThrows<java.lang.String,java.io.IOException> lineConsumer(java.io.File file,
java.lang.String charsetName,
boolean append)
throws java.io.IOException
Consumer that writes lines to the given file with the given encoding
java.io.IOException
public static ConsumerWhichThrows<java.lang.String,java.io.IOException> lineConsumer(java.io.Writer writer,
boolean closeOnFinalize)
Consumer that writes strings to the given Writer, augmented with a line separator
public static Consumer<java.lang.String> lineConsumer(java.io.PrintStream printStream,
boolean closeOnFinalize)
Consumer that writes strings to the given Writer, augmented with a line separatorpublic static <T> Producer<Consumer<T>> combine(Consumer<T> target)
T. The subjects sent to these consumers are
forwarded immediately to the given target.
combineInOrder(ConsumerWhichThrows)public static <T,EX extends java.lang.Exception> Producer<ConsumerWhichThrows<T,EX>> combineInOrder(ConsumerWhichThrows<T,EX> target)
T. The first subject sent to each of these consumers
is passed to the given target in the order the consumers were created (not in the order in
which the subjects were sent to the consumers).
combine(Consumer)
public static <T,EX extends java.lang.Exception> java.util.List<ConsumerWhichThrows<T,EX>> splice(int n,
ConsumerWhichThrows<java.util.List<T>,EX> target)
n. When all comsumers have consumed their first subject, then these
subjects are passed to the target consumer; then again when all consumers have consumed their second
subject, and so on.
public static <T> Consumer<T> addToCollection(java.util.Collection<T> drain)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||