List of usage examples for java.io Closeable close
public void close() throws IOException;
From source file:org.apache.jxtadoop.io.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 the log to record problems to at debug level. Can be null. * @param closeables the objects to close *///from www. j a va 2s . c o m public static void cleanup(Log log, java.io.Closeable... closeables) { for (java.io.Closeable c : closeables) { if (c != null) { try { c.close(); } catch (IOException e) { LOG.debug("Exception in closing the stream : " + e.getMessage()); if (log != null && log.isDebugEnabled()) { log.debug("Exception in closing " + c, e); } } } } }
From source file:org.wso2.carbon.transport.remotefilesystem.client.connector.contractimpl.VFSClientConnectorImpl.java
/** * Closes streams quietly/*from w ww . j av a 2 s . c o m*/ * * @param closeable The stream that should be closed */ private static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (IOException e) { // Do nothing. } }
From source file:com.skin.generator.action.UploadTestAction.java
/** * @param closeable/* w w w. j a v a2 s.c o m*/ */ public static void close(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException e) { } } }
From source file:com.fizzed.blaze.util.Streamables.java
static public void close(Closeable stream) throws BlazeException { if (stream != null) { try {//from w ww. ja v a2s.c om stream.close(); } catch (IOException e) { throw new WrappedBlazeException(e); } } }
From source file:com.futureplatforms.kirin.internal.attic.IOUtils.java
public static void close(Closeable stream) { if (stream != null) { try {/*ww w . j a va 2s . c o m*/ stream.close(); } catch (IOException e) { Log.v(C.TAG, "An extremely rare IOException while closing problem was reported", e); } } }
From source file:ar.com.tadp.xml.rinzo.core.utils.FileUtils.java
public static void safeClose(Closeable c) { try {// w ww .j a v a 2 s.c om if (c != null) { c.close(); } } catch (Exception e) { } }
From source file:com.healthmarketscience.rmiio.RmiioUtil.java
/** * Closes the given Closeable if non-{@code null}, swallowing any * IOExceptions generated./*www . j a va 2 s . c om*/ */ static void closeQuietly(Closeable closeable) { // yes, this has been written many times before and elsewhere, but i did // not want to add a dependency just for one method if (closeable != null) { try { closeable.close(); } catch (IOException e) { // optionally log the exception, but otherwise ignore if (LOG.isDebugEnabled()) { LOG.debug("Failed closing closeable", e); } } } }
From source file:org.apache.commons.net.examples.ftp.TFTPExample.java
private static boolean close(TFTPClient tftp, Closeable output) { boolean closed; tftp.close();// ww w.ja v a 2 s.c om try { if (output != null) { output.close(); } closed = true; } catch (IOException e) { closed = false; System.err.println("Error: error closing file."); System.err.println(e.getMessage()); } return closed; }
From source file:org.wso2.carbon.transport.file.connector.sender.VFSClientConnector.java
/** * Closes streams quietly/*from w w w. j a va 2 s . c o m*/ * @param closeable The stream that should be closed */ private static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (IOException e) { logger.error("Error occurred when closing stream", e); } }
From source file:com.igormaznitsa.j2z80.utils.Utils.java
/** * Silently close any closeable object/*from w ww . jav a 2 s. co m*/ * * @param closeableOne the object to be closed, it can be null */ public static void silentlyClose(final Closeable closeableOne) { if (closeableOne != null) { try { closeableOne.close(); } catch (IOException ex) { } } }