Example usage for java.io Closeable close

List of usage examples for java.io Closeable close

Introduction

In this page you can find the example usage for java.io Closeable close.

Prototype

public void close() throws IOException;

Source Link

Document

Closes this stream and releases any system resources associated with it.

Usage

From source file:com.nridge.core.base.io.IO.java

public static void closeQuietly(Closeable aCloseable) {
    if (aCloseable != null) {
        try {//from   w w w .  j a v  a2 s. c  om
            aCloseable.close();
        } catch (Exception ignored) {
        }
    }
}

From source file:se.vgregion.webbisar.web.MediaServlet.java

private static void close(Closeable resource) {
    if (resource != null) {
        try {/*from  ww  w  . java 2s  .c  om*/
            resource.close();
        } catch (IOException e) {
            LOGGER.error("Could not close resource", e);
        }
    }
}

From source file:Main.java

public static void closeIO(Closeable... closeables) {
    if (null == closeables || closeables.length <= 0) {
        return;//from  w w  w  .ja va2  s . c o  m
    }
    for (Closeable cb : closeables) {
        try {
            if (null == cb) {
                continue;
            }
            cb.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.machinepublishers.jbrowserdriver.Util.java

static void close(Closeable closeable) {
    if (closeable != null) {
        try {/*from  w w  w .  j  av  a 2 s .c  om*/
            closeable.close();
        } catch (Throwable t) {
        }
    }
}

From source file:edu.harvard.i2b2.fhirserver.ws.FileServlet.java

private static void close(Closeable resource) {
    if (resource != null) {
        try {// ww w  . java  2s  .co m
            resource.close();
        } catch (IOException e) {
            // Do your thing with the exception. Print it, log it or mail it.
            e.printStackTrace();
        }
    }
}

From source file:org.wso2.carbon.analytics.dashboard.admin.RegistryUtils.java

/**
 * Close colseables/*from  w ww. j a va2  s. c  o m*/
 */
private static void closeQuitely(Closeable closeable) {
    try {
        if (closeable != null) {
            closeable.close();
        }
    } catch (IOException ignore) {
        /* ignore */
    }
}

From source file:com.android.exchange.adapter.AttachmentLoader.java

/**
 * Close, ignoring errors (as during cleanup)
 * @param c a Closeable// w w  w  .ja  v  a  2  s .  com
 */
private static void close(Closeable c) {
    try {
        c.close();
    } catch (IOException e) {
    }
}

From source file:Main.java

public static void closeSilently(Closeable c) {
    if (c == null)
        return;/*from   ww  w.ja v  a2 s.c  om*/
    try {
        c.close();
    } catch (Throwable t) {
        // Do nothing
    }
}

From source file:org.apache.bookkeeper.util.IOUtils.java

/**
 * Close the Closeable objects and <b>ignore</b> any {@link IOException} or
 * null pointers. Must only be used for cleanup in exception handlers.
 *
 * @param log//from www .  j ava  2 s. c om
 *            the log to record problems to at debug level. Can be null.
 * @param closeables
 *            the objects to close
 */
public static void close(Logger log, java.io.Closeable... closeables) {
    for (java.io.Closeable c : closeables) {
        if (c != null) {
            try {
                c.close();
            } catch (IOException e) {
                if (log != null && log.isDebugEnabled()) {
                    log.debug("Exception in closing " + c, e);
                }
            }
        }
    }
}

From source file:com.liferay.mobile.android.util.PortraitUtil.java

protected static void close(Closeable closeable) {
    if (closeable != null) {
        try {//from   w ww .j  a va  2s.  c  om
            closeable.close();
        } catch (IOException ioe) {
        }
    }
}