Package org.apache.commons.io.function
Class Uncheck
java.lang.Object
org.apache.commons.io.function.Uncheck
Unchecks calls by throwing
UncheckedIOException instead of IOException.- Since:
- 2.12.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,U> void accept(IOBiConsumer<T, U> consumer, T t, U u) Accepts an IO consumer with the given arguments.static <T> voidaccept(IOConsumer<T> consumer, T t) Accepts an IO consumer with the given argument.static voidaccept(IOIntConsumer consumer, int i) Accepts an IO consumer with the given argument.static <T,U, V> void accept(IOTriConsumer<T, U, V> consumer, T t, U u, V v) Accepts an IO consumer with the given arguments.static <T,U, R> R apply(IOBiFunction<T, U, R> function, T t, U u) Applies an IO function with the given arguments.static <T,R> R apply(IOFunction<T, R> function, T t) Applies an IO function with the given arguments.static <T,U, V, W, R>
Rapply(IOQuadFunction<T, U, V, W, R> function, T t, U u, V v, W w) Applies an IO quad-function with the given arguments.static <T,U, V, R>
Rapply(IOTriFunction<T, U, V, R> function, T t, U u, V v) Applies an IO tri-function with the given arguments.static <T> intcompare(IOComparator<T> comparator, T t, T u) Compares the arguments with the comparator.static <T> Tget(IOSupplier<T> supplier) Gets the result from an IO supplier.static <T> Tget(IOSupplier<T> supplier, Supplier<String> message) Gets the result from an IO supplier.static booleangetAsBoolean(IOBooleanSupplier supplier) Gets the result from an IO boolean supplier.static intgetAsInt(IOIntSupplier supplier) Gets the result from an IO int supplier.static intgetAsInt(IOIntSupplier supplier, Supplier<String> message) Gets the result from an IO int supplier.static longgetAsLong(IOLongSupplier supplier) Gets the result from an IO long supplier.static longgetAsLong(IOLongSupplier supplier, Supplier<String> message) Gets the result from an IO long supplier.static voidrun(IORunnable runnable) Runs an IO runnable.static voidrun(IORunnable runnable, Supplier<String> message) Runs an IO runnable.static <T> booleantest(IOPredicate<T> predicate, T t) Tests an IO predicate.
-
Method Details
-
accept
Accepts an IO consumer with the given arguments.- Type Parameters:
T- the first input type.U- the second input type.- Parameters:
consumer- Consumes the value.t- the first input argument.u- the second input argument.- Throws:
UncheckedIOException- if an I/O error occurs.
-
accept
Accepts an IO consumer with the given argument.- Type Parameters:
T- the input type.- Parameters:
consumer- Consumes the value.t- the input argument.- Throws:
UncheckedIOException- if an I/O error occurs.
-
accept
Accepts an IO consumer with the given argument.- Parameters:
consumer- Consumes the value.i- the input argument.- Throws:
UncheckedIOException- if an I/O error occurs.- Since:
- 2.18.0
-
accept
Accepts an IO consumer with the given arguments.- Type Parameters:
T- the first input type.U- the second input type.V- the third input type.- Parameters:
consumer- Consumes the value.t- the first input argument.u- the second input argument.v- the third input argument.- Throws:
UncheckedIOException- if an I/O error occurs.
-
apply
Applies an IO function with the given arguments.- Type Parameters:
T- the first function argument type.U- the second function argument type.R- the return type.- Parameters:
function- the function.t- the first function argument.u- the second function argument.- Returns:
- the function result.
- Throws:
UncheckedIOException- if an I/O error occurs.
-
apply
Applies an IO function with the given arguments.- Type Parameters:
T- the first function argument type.R- the return type.- Parameters:
function- the function.t- the first function argument.- Returns:
- the function result.
- Throws:
UncheckedIOException- if an I/O error occurs.
-
apply
Applies an IO quad-function with the given arguments.- Type Parameters:
T- the first function argument type.U- the second function argument type.V- the third function argument type.W- the fourth function argument type.R- the return type.- Parameters:
function- the function.t- the first function argument.u- the second function argument.v- the third function argument.w- the fourth function argument.- Returns:
- the function result.
- Throws:
UncheckedIOException- if an I/O error occurs.
-
apply
Applies an IO tri-function with the given arguments.- Type Parameters:
T- the first function argument type.U- the second function argument type.V- the third function argument type.R- the return type.- Parameters:
function- the function.t- the first function argument.u- the second function argument.v- the third function argument.- Returns:
- the function result.
- Throws:
UncheckedIOException- if an I/O error occurs.
-
compare
Compares the arguments with the comparator.- Type Parameters:
T- the first function argument type.- Parameters:
comparator- the function.t- the first function argument.u- the second function argument.- Returns:
- the comparator result.
- Throws:
UncheckedIOException- if an I/O error occurs.
-
get
Gets the result from an IO supplier.- Type Parameters:
T- the return type of the operations.- Parameters:
supplier- Supplies the return value.- Returns:
- result from the supplier.
- Throws:
UncheckedIOException- if an I/O error occurs.
-
get
Gets the result from an IO supplier.- Type Parameters:
T- the return type of the operations.- Parameters:
supplier- Supplies the return value.message- The UncheckedIOException message if an I/O error occurs.- Returns:
- result from the supplier.
- Throws:
UncheckedIOException- if an I/O error occurs.
-
getAsBoolean
Gets the result from an IO boolean supplier.- Parameters:
supplier- Supplies the return value.- Returns:
- result from the supplier.
- Throws:
UncheckedIOException- if an I/O error occurs.- Since:
- 2.19.0
-
getAsInt
Gets the result from an IO int supplier.- Parameters:
supplier- Supplies the return value.- Returns:
- result from the supplier.
- Throws:
UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
getAsInt
Gets the result from an IO int supplier.- Parameters:
supplier- Supplies the return value.message- The UncheckedIOException message if an I/O error occurs.- Returns:
- result from the supplier.
- Throws:
UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
getAsLong
Gets the result from an IO long supplier.- Parameters:
supplier- Supplies the return value.- Returns:
- result from the supplier.
- Throws:
UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
getAsLong
Gets the result from an IO long supplier.- Parameters:
supplier- Supplies the return value.message- The UncheckedIOException message if an I/O error occurs.- Returns:
- result from the supplier.
- Throws:
UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
run
Runs an IO runnable.- Parameters:
runnable- The runnable to run.- Throws:
UncheckedIOException- if an I/O error occurs.
-
run
Runs an IO runnable.- Parameters:
runnable- The runnable to run.message- The UncheckedIOException message if an I/O error occurs.- Throws:
UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
test
Tests an IO predicate.- Type Parameters:
T- the type of the input to the predicate.- Parameters:
predicate- the predicate.t- the input to the predicate.- Returns:
trueif the input argument matches the predicate, otherwisefalse.
-