Package org.apache.commons.io.function
Class Uncheck
- java.lang.Object
-
- org.apache.commons.io.function.Uncheck
-
public final class Uncheck extends java.lang.ObjectUnchecks calls by throwingUncheckedIOExceptioninstead ofIOException.- Since:
- 2.12.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,U>
voidaccept(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 <T,U,V>
voidaccept(IOTriConsumer<T,U,V> consumer, T t, U u, V v)Accepts an IO consumer with the given arguments.static <T,U,R>
Rapply(IOBiFunction<T,U,R> function, T t, U u)Applies an IO function with the given arguments.static <T,R>
Rapply(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, java.util.function.Supplier<java.lang.String> message)Gets the result from an IO supplier.static intgetAsInt(IOIntSupplier supplier)Gets the result from an IO int supplier.static intgetAsInt(IOIntSupplier supplier, java.util.function.Supplier<java.lang.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, java.util.function.Supplier<java.lang.String> message)Gets the result from an IO long supplier.static voidrun(IORunnable runnable)Runs an IO runnable.static voidrun(IORunnable runnable, java.util.function.Supplier<java.lang.String> message)Runs an IO runnable.static <T> booleantest(IOPredicate<T> predicate, T t)Tests an IO predicate.
-
-
-
Method Detail
-
accept
public static <T,U> void accept(IOBiConsumer<T,U> consumer, T t, U u)
Accepts an IO consumer with the given arguments.- Type Parameters:
T- the first input type.U- the second input type.- Parameters:
t- the first input argument.u- the second input argument.consumer- Consumes the value.- Throws:
java.io.UncheckedIOException- if an I/O error occurs.
-
accept
public static <T> void accept(IOConsumer<T> consumer, T t)
Accepts an IO consumer with the given argument.- Type Parameters:
T- the input type.- Parameters:
t- the input argument.consumer- Consumes the value.- Throws:
java.io.UncheckedIOException- if an I/O error occurs.
-
accept
public 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.- Type Parameters:
T- the first input type.U- the second input type.V- the third input type.- Parameters:
t- the first input argument.u- the second input argument.v- the third input argument.consumer- Consumes the value.- Throws:
java.io.UncheckedIOException- if an I/O error occurs.
-
apply
public static <T,U,R> R apply(IOBiFunction<T,U,R> function, T t, U u)
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:
java.io.UncheckedIOException- if an I/O error occurs.
-
apply
public static <T,R> R apply(IOFunction<T,R> function, T t)
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:
java.io.UncheckedIOException- if an I/O error occurs.
-
apply
public static <T,U,V,W,R> R apply(IOQuadFunction<T,U,V,W,R> function, T t, U u, V v, W w)
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:
java.io.UncheckedIOException- if an I/O error occurs.
-
apply
public static <T,U,V,R> R apply(IOTriFunction<T,U,V,R> function, T t, U u, V v)
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:
java.io.UncheckedIOException- if an I/O error occurs.
-
compare
public static <T> int compare(IOComparator<T> comparator, T t, T u)
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:
java.io.UncheckedIOException- if an I/O error occurs.
-
get
public static <T> T get(IOSupplier<T> supplier)
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:
java.io.UncheckedIOException- if an I/O error occurs.
-
get
public static <T> T get(IOSupplier<T> supplier, java.util.function.Supplier<java.lang.String> message)
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:
java.io.UncheckedIOException- if an I/O error occurs.
-
getAsInt
public static int getAsInt(IOIntSupplier supplier)
Gets the result from an IO int supplier.- Parameters:
supplier- Supplies the return value.- Returns:
- result from the supplier.
- Throws:
java.io.UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
getAsInt
public static int getAsInt(IOIntSupplier supplier, java.util.function.Supplier<java.lang.String> message)
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:
java.io.UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
getAsLong
public static long getAsLong(IOLongSupplier supplier)
Gets the result from an IO long supplier.- Parameters:
supplier- Supplies the return value.- Returns:
- result from the supplier.
- Throws:
java.io.UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
getAsLong
public static long getAsLong(IOLongSupplier supplier, java.util.function.Supplier<java.lang.String> message)
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:
java.io.UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
run
public static void run(IORunnable runnable)
Runs an IO runnable.- Parameters:
runnable- The runnable to run.- Throws:
java.io.UncheckedIOException- if an I/O error occurs.
-
run
public static void run(IORunnable runnable, java.util.function.Supplier<java.lang.String> message)
Runs an IO runnable.- Parameters:
runnable- The runnable to run.message- The UncheckedIOException message if an I/O error occurs.- Throws:
java.io.UncheckedIOException- if an I/O error occurs.- Since:
- 2.14.0
-
test
public static <T> boolean test(IOPredicate<T> predicate, T t)
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.
-
-