Interface IOConsumer<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 IOConsumer<T>
    Represents an I/O operation that accepts a single input argument and returns no result.

    This interface is similar to Consumer except that it is allowed to throw an IOException.

    Author:
    Garret Wilson
    See Also:
    Consumer
    • Method Detail

      • accept

        void accept​(@Nonnull
                    T t)
             throws java.io.IOException

        This method is the same as Consumer.accept(Object), but with a support for IOException.

        Parameters:
        t - the input argument
        Throws:
        java.io.IOException - if there is an I/O error performing the operation
      • andThen

        default IOConsumer<T> andThen​(@Nonnull
                                      IOConsumer<? super T> after)
                               throws java.io.IOException

        This method is the same as Consumer.andThen(Consumer), but with a support for IOException.

        Parameters:
        after - The operation to perform after this operation.
        Returns:
        A consumer that performs this operation followed by the given operation in sequence.
        Throws:
        java.io.IOException - if there is an I/O error performing the operation.