Class FunctionalIO
java.lang.Object
org.apache.hadoop.util.functional.FunctionalIO
Functional utilities for IO operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TextractIOExceptions(Supplier<T> call) Invoke the supplier, catching anyUncheckedIOExceptionraised, extracting the inner IOException and rethrowing it.static <T,R> Function<T, R> toUncheckedFunction(FunctionRaisingIOE<T, R> fun) Convert aFunctionRaisingIOEas aSupplier.static <T> Supplier<T>Wrap aCallableRaisingIOEas aSupplier.static <T> TuncheckIOExceptions(CallableRaisingIOE<T> call) Invoke any operation, wrapping IOExceptions withUncheckedIOException.
-
Method Details
-
uncheckIOExceptions
Invoke any operation, wrapping IOExceptions withUncheckedIOException.- Type Parameters:
T- type of result- Parameters:
call- callable- Returns:
- result
- Throws:
UncheckedIOException- if an IOE was raised.
-
toUncheckedIOExceptionSupplier
Wrap aCallableRaisingIOEas aSupplier.- Type Parameters:
T- type of result- Parameters:
call- call to wrap- Returns:
- a supplier which invokes the call.
-
extractIOExceptions
Invoke the supplier, catching anyUncheckedIOExceptionraised, extracting the inner IOException and rethrowing it.- Type Parameters:
T- type of result- Parameters:
call- call to invoke- Returns:
- result
- Throws:
IOException- if the call raised an IOException wrapped by an UncheckedIOException.
-
toUncheckedFunction
Convert aFunctionRaisingIOEas aSupplier.- Type Parameters:
T- type of inputR- type of return value.- Parameters:
fun- function to wrap- Returns:
- a new function which invokes the inner function and wraps exceptions.
-