T
- the type of the input to the operations.@FunctionalInterface
public interface IOConsumer<T>
Consumer
but throws IOException
.Modifier and Type | Field and Description |
---|---|
static IOConsumer<?> |
NOOP_IO_CONSUMER
Consider private.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T t)
Performs this operation on the given argument.
|
default IOConsumer<T> |
andThen(IOConsumer<? super T> after)
Returns a composed
IOConsumer that performs, in sequence, this operation followed by the after
operation. |
default java.util.function.Consumer<T> |
asConsumer()
Creates a
Consumer for this instance that throws UncheckedIOException instead of IOException . |
static <T> void |
forAll(IOConsumer<T> action,
java.lang.Iterable<T> iterable)
Performs an action for each element of the collection gathering any exceptions.
|
static <T> void |
forAll(IOConsumer<T> action,
java.util.stream.Stream<T> stream)
Performs an action for each element of the collection gathering any exceptions.
|
static <T> void |
forAll(IOConsumer<T> action,
T... array)
Performs an action for each element of the array gathering any exceptions.
|
static <T> void |
forEach(java.lang.Iterable<T> iterable,
IOConsumer<T> action)
Performs an action for each element of the collection, stopping at the first exception.
|
static <T> void |
forEach(java.util.stream.Stream<T> stream,
IOConsumer<T> action)
Performs an action for each element of the stream, stopping at the first exception.
|
static <T> void |
forEach(T[] array,
IOConsumer<T> action)
Performs an action for each element of this array, stopping at the first exception.
|
static <T> IOConsumer<T> |
noop()
Returns the constant no-op consumer.
|
static final IOConsumer<?> NOOP_IO_CONSUMER
static <T> void forAll(IOConsumer<T> action, java.lang.Iterable<T> iterable) throws IOExceptionList
T
- The element type.action
- The action to apply to each input element.iterable
- The input to stream.IOExceptionList
- if any I/O errors occur.static <T> void forAll(IOConsumer<T> action, java.util.stream.Stream<T> stream) throws IOExceptionList
T
- The element type.action
- The action to apply to each input element.stream
- The input to stream.IOExceptionList
- if any I/O errors occur.@SafeVarargs static <T> void forAll(IOConsumer<T> action, T... array) throws IOExceptionList
T
- The element type.action
- The action to apply to each input element.array
- The input to stream.IOExceptionList
- if any I/O errors occur.static <T> void forEach(java.lang.Iterable<T> iterable, IOConsumer<T> action) throws java.io.IOException
T
- The element type.iterable
- The input to stream.action
- The action to apply to each input element.java.io.IOException
- if an I/O error occurs.static <T> void forEach(java.util.stream.Stream<T> stream, IOConsumer<T> action) throws java.io.IOException
T
- The element type.stream
- The input to stream.action
- The action to apply to each input element.java.io.IOException
- if an I/O error occurs.static <T> void forEach(T[] array, IOConsumer<T> action) throws java.io.IOException
T
- The element type.array
- The input to stream.action
- The action to apply to each input element.java.io.IOException
- if an I/O error occurs.static <T> IOConsumer<T> noop()
T
- Type consumer type.void accept(T t) throws java.io.IOException
t
- the input argumentjava.io.IOException
- if an I/O error occurs.default IOConsumer<T> andThen(IOConsumer<? super T> after)
IOConsumer
that performs, in sequence, this operation followed by the after
operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation.
If performing this operation throws an exception, the after
operation will not be performed.after
- the operation to perform after this operationConsumer
that performs in sequence this operation followed by the after
operationjava.lang.NullPointerException
- if after
is nulldefault java.util.function.Consumer<T> asConsumer()
Consumer
for this instance that throws UncheckedIOException
instead of IOException
.Copyright © 2010 - 2023 Adobe. All Rights Reserved