T
- The type of the input to the operation.@FunctionalInterface public interface IOConsumer<T>
IOException
throwing equivalent of Consumer
.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. |
static <T> IOConsumer<T> |
checked(Consumer<? super T> operation)
Returns an
IOConsumer that performs the operation operation, and unwraps any UncheckedIOException that is thrown by
throwing its cause . |
static <T> Consumer<T> |
unchecked(IOConsumer<? super T> operation)
Returns a
Consumer that performs the operation operation, and wraps any IOException that is thrown in an
UncheckedIOException . |
void accept(T t) throws IOException
t
- The input argument.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 operation.IOConsumer
that performs in sequence this operation followed by the after
operation.NullPointerException
- If after
is null
.static <T> Consumer<T> unchecked(IOConsumer<? super T> operation)
Consumer
that performs the operation
operation, and wraps any IOException
that is thrown in an
UncheckedIOException
.T
- The type of the input to the operation.operation
- The operation to perform when the returned operation is performed.Consumer
that performs the operation
operation on its input, and wraps any IOException
that is thrown in
an UncheckedIOException
.NullPointerException
- If operation
is null
.static <T> IOConsumer<T> checked(Consumer<? super T> operation)
IOConsumer
that performs the operation
operation, and unwraps any UncheckedIOException
that is thrown by
throwing its cause
.T
- The type of the input to the operation.operation
- The operation to perform when the returned operation is performed.IOConsumer
that performs the operation
operation on its input, and unwraps any UncheckedIOException
that
is thrown.NullPointerException
- If the given operation is null
.Copyright © 2017–2020. All rights reserved.