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

net.dongliu.commons.io.Closeables Maven / Gradle / Ivy

There is a newer version: 12.0.2
Show newest version
package net.dongliu.commons.io;


import org.jetbrains.annotations.Nullable;

/**
 * Utils for deal with Closeables and AutoCloseables
 */
public class Closeables {

    /**
     * Close the closeable, if exception occurred, silently swallow it.
     *
     * @param closeable the instance to be close. can be null
     */
    public static void closeQuietly(@Nullable AutoCloseable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (Exception ignore) {
            }
        }
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy