Interface IOExceptionThrowingConsumer<T>

  • Type Parameters:
    T - the type of the input to the operation
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface IOExceptionThrowingConsumer<T>
    Represents an operation that accepts a single input argument and returns no result. Can potentially throw an IOException while doing so.
    Since:
    1.2.0
    Author:
    Ozren Dabić
    See Also:
    Consumer
    • Method Detail

      • accept

        void accept​(T t)
             throws IOException
        Performs this operation on the given argument.
        Parameters:
        t - the input argument
        Throws:
        IOException - if an I/O error occurs
      • toUnchecked

        static <T> Consumer<T> toUnchecked​(@NotNull
                                           @NotNull IOExceptionThrowingConsumer<T> consumer)
        Returns a wrapped Consumer that performs this operation. If performing said operation results in an IOException, it is re-thrown as its unchecked counterpart: UncheckedIOException.
        Type Parameters:
        T - the type of the input to the operation
        Parameters:
        consumer - the operation to wrap
        Returns:
        and identical Consumer that throws UncheckedIOException instead
        Throws:
        NullPointerException - if consumer is null