Interface IOFunction<T,R>
- Type Parameters:
T- the type of the inputR- the type of the result
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Like
SafeFunction but only for IOException-
Method Summary
Modifier and TypeMethodDescriptionApply the function, possibly throwing an exception.applyCatching(T t) Apply the function, catching any exceptions and wrapping them in aResultTurn thisIOFunctioninto aFunctionthat sneaky throws any exceptions.static <T,R> IOFunction <T, R> constant(R r) AIOFunctionthat always returns the same value, ignoring the input.static <T,R> IOFunction <T, R> Wrap aFunctionin aIOFunction
-
Method Details
-
constant
AIOFunctionthat always returns the same value, ignoring the input.- Type Parameters:
T- the type of the inputR- the type of the result- Parameters:
r- the value to return- Returns:
- a
IOFunctionthat always returns the given value
-
of
Wrap aFunctionin aIOFunction- Type Parameters:
T- the type of the inputR- the type of the result- Parameters:
function- the function to wrap- Returns:
- a
IOFunctionthat delegates to the given function
-
apply
Apply the function, possibly throwing an exception.- Parameters:
t- the input- Returns:
- the result
- Throws:
IOException- if an I/O error occurs
-
applyCatching
-
asFunction
-