Class Uncheck

java.lang.Object
org.apache.commons.io.function.Uncheck

public final class Uncheck extends Object
Unchecks calls by throwing UncheckedIOException instead of IOException.
Since:
2.12.0
  • Method Details

    • 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:
      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:
      UncheckedIOException - if an I/O error occurs.
    • accept

      public static void accept(IOIntConsumer consumer, int i)
      Accepts an IO consumer with the given argument.
      Parameters:
      i - the input argument.
      consumer - Consumes the value.
      Throws:
      UncheckedIOException - if an I/O error occurs.
      Since:
      2.18.0
    • 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:
      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:
      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:
      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:
      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:
      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:
      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:
      UncheckedIOException - if an I/O error occurs.
    • get

      public static <T> T get(IOSupplier<T> supplier, Supplier<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:
      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:
      UncheckedIOException - if an I/O error occurs.
      Since:
      2.14.0
    • getAsInt

      public static int getAsInt(IOIntSupplier supplier, Supplier<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:
      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:
      UncheckedIOException - if an I/O error occurs.
      Since:
      2.14.0
    • getAsLong

      public static long getAsLong(IOLongSupplier supplier, Supplier<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:
      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:
      UncheckedIOException - if an I/O error occurs.
    • run

      public static void run(IORunnable runnable, Supplier<String> message)
      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

      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:
      true if the input argument matches the predicate, otherwise false.