T
- The type of the input to the function.R
- The type of the result of the function.@FunctionalInterface public interface IOFunction<T,R>
IOException
throwing equivalent of Function
.Modifier and Type | Method and Description |
---|---|
default <V> IOFunction<T,V> |
andThen(IOFunction<? super R,? extends V> after)
Returns a composed function that first applies this function to its input, and then applies the
after function to the result. |
R |
apply(T t)
Applies this function to the given argument.
|
static <T,R> IOFunction<T,R> |
checked(Function<? super T,? extends R> function)
Returns a function that applies the
function function to its input, and unwraps any UncheckedIOException that is thrown by
throwing its cause . |
default <V> IOFunction<V,R> |
compose(IOFunction<? super V,? extends T> before)
Returns a composed function that first applies the
before function to its input, and then applies this function to the result. |
static <T> IOFunction<T,T> |
identity()
Returns a function that always returns its input argument.
|
static <T,R> Function<T,R> |
unchecked(IOFunction<? super T,? extends R> function)
Returns a function that applies the
function function to its input, and wraps any IOException that is thrown in an
UncheckedIOException . |
R apply(T t) throws IOException
t
- The function argument.IOException
- If an I/O error occurs.default <V> IOFunction<V,R> compose(IOFunction<? super V,? extends T> before)
before
function to its input, and then applies this function to the result.
If evaluation of either function throws an exception, it is relayed to the caller of the composed function.V
- The type of input to the before
function, and to the composed function.before
- The function to apply before this function is applied.before
function and then applies this function.NullPointerException
- If before
is null
.andThen(IOFunction)
default <V> IOFunction<T,V> andThen(IOFunction<? super R,? extends V> after)
after
function to the result.
If evaluation of either function throws an exception, it is relayed to the caller of the composed function.V
- The type of output of the after
function, and of the composed function.after
- The function to apply after this function is applied.after
function.NullPointerException
- If after
is null
.compose(IOFunction)
static <T> IOFunction<T,T> identity()
T
- The type of the input and output objects to the function.static <T,R> Function<T,R> unchecked(IOFunction<? super T,? extends R> function)
function
function to its input, and wraps any IOException
that is thrown in an
UncheckedIOException
.T
- The type of the input to the function.R
- The type of the result of the function.function
- The function to apply when the returned function is applied.function
function to its input, and wraps any IOException
that is thrown in an
UncheckedIOException
.NullPointerException
- If function
is null
.static <T,R> IOFunction<T,R> checked(Function<? super T,? extends R> function)
function
function to its input, and unwraps any UncheckedIOException
that is thrown by
throwing its cause
.T
- The type of the input to the function.R
- The type of the result of the function.function
- The function to apply when the returned function is applied.function
function to its input, and unwraps any UncheckedIOException
that is thrown.NullPointerException
- If function
is null
.Copyright © 2017–2020. All rights reserved.