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

gov.nasa.pds.harvest.util.CloseUtils Maven / Gradle / Ivy

package gov.nasa.pds.harvest.util;

import java.io.Closeable;

import javax.xml.stream.XMLEventReader;

/**
 * Close resources without throwing exceptions.
 * 
 * @author karpenko
 */
public class CloseUtils
{
    public static void close(Closeable cl)
    {
        if(cl == null) return;
        
        try
        {
            cl.close();
        }
        catch(Exception ex)
        {
            // Ignore
        }
    }
    

    public static void close(XMLEventReader cl)
    {
        if(cl == null) return;
        
        try
        {
            cl.close();
        }
        catch(Exception ex)
        {
            // Ignore
        }
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy