All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.yetamine.lang.closeables.SafeCloseableResource Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
package net.yetamine.lang.closeables;

/**
 * A generic interface for adapting resource-like objects that do not implement
 * {@link SafeCloseable} (yet) and therefore try-with-resources can't manage
 * them, or require yet another catch block to deal with exceptions possibly
 * thrown from the {@link AutoCloseable#close()} method.
 *
 * @param 
 *            the type of the adapted resource
 */
public interface SafeCloseableResource extends SafeCloseable, AutoCloseableResource {

    /**
     * Implementations should rather avoid throwing any exceptions, so that an
     * exception shall be rather a programming error than an actual failure.
     *
     * @see java.lang.AutoCloseable#close()
     */
    void close();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy