
com.artipie.asto.misc.UncheckedIOSupplier Maven / Gradle / Ivy
/*
* The MIT License (MIT) Copyright (c) 2020-2023 artipie.com
* https://github.com/artipie/artipie/blob/master/LICENSE.txt
*/
package com.artipie.asto.misc;
import com.artipie.asto.ArtipieIOException;
import java.io.IOException;
import java.util.function.Supplier;
/**
* Unchecked IO {@link Supplier}.
* @param Supplier type
* @since 1.8
*/
public final class UncheckedIOSupplier implements Supplier {
/**
* Checked version.
*/
private final UncheckedSupplier.CheckedSupplier checked;
/**
* Ctor.
* @param checked Checked func
*/
public UncheckedIOSupplier(
final UncheckedSupplier.CheckedSupplier checked
) {
this.checked = checked;
}
@Override
@SuppressWarnings("PMD.AvoidCatchingGenericException")
public T get() {
try {
return this.checked.get();
} catch (final IOException err) {
throw new ArtipieIOException(err);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy