se.l4.commons.io.IoConsumer Maven / Gradle / Ivy
The newest version!
package se.l4.commons.io;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.function.Consumer;
public interface IoConsumer
{
void accept(T item)
throws IOException;
static Consumer adapt(IoConsumer consumer)
{
return item -> {
try
{
consumer.accept(item);
}
catch(IOException e)
{
throw new UncheckedIOException("IOException while running; " + e.getMessage(), e);
}
};
}
}