com.quorum.tessera.io.IOCallback Maven / Gradle / Ivy
package com.quorum.tessera.io;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.UncheckedIOException;
/**
* Callback and template function to uncheck IO exceptions
*
* @param the function to execute that throws an {@link IOException}
*/
@FunctionalInterface
public interface IOCallback {
Logger LOGGER = LoggerFactory.getLogger(IOCallback.class);
T doExecute() throws IOException;
static T execute(IOCallback callback) {
try {
return callback.doExecute();
} catch (final IOException ex) {
LOGGER.debug(null, ex);
throw new UncheckedIOException(ex);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy