List of usage examples for java.io Closeable close
public void close() throws IOException;
From source file:com.addthis.hydra.query.web.GoogleDriveAuthentication.java
/** * If a resource a non-null then close the resource. Catch any IOExceptions and log them. *//* ww w . j a v a 2 s .com*/ private static void closeResource(@Nullable Closeable resource) { try { if (resource != null) { resource.close(); } } catch (IOException ex) { log.error("Error", ex); } }
From source file:com.bradmcevoy.io.FileUtils.java
public static void close(Closeable in) { try {//from w w w .jav a 2 s . co m if (in == null) return; in.close(); } catch (IOException ex) { } }
From source file:com.kwoksys.biz.files.FileService.java
private static void close(Closeable stream) { if (stream != null) { try {/*w ww . ja va2 s.c om*/ stream.close(); } catch (IOException ignore) { /* ignored */} } }
From source file:org.collectionspace.services.common.FileUtilities.java
/** * Attempt to close a resource, swallowing any Exceptions thrown. * This method should only be called from within the 'finally' portion * of a 'catch/try/finally' block./*ww w . ja v a 2 s .c o m*/ * See http://stackoverflow.com/questions/2699209/java-io-ugly-try-finally-block * and http://stackoverflow.com/questions/341971/what-is-the-execute-around-idiom * @param c A closeable resource. */ public static void closeQuietly(Closeable c) { if (c != null) try { c.close(); } catch (Exception e) { logger.trace("Failed to close filewriter.", e); // Do nothing here } }
From source file:org.owasp.dependencycheck.utils.ExtractionUtil.java
/** * Closes the stream.// www .j a v a2 s .c om * * @param stream the stream to close */ private static void closeStream(Closeable stream) { if (stream != null) { try { stream.close(); } catch (IOException ex) { LOGGER.trace("", ex); } } }
From source file:com.puppycrawl.tools.checkstyle.api.Utils.java
/** * Closes the supplied {@link Closeable} object ignoring an * {@link IOException} if it is thrown. Honestly, what are you going to * do if you cannot close a file./*from w w w .jav a2s.co m*/ * @param shutting the object to be closed. */ public static void closeQuietly(Closeable shutting) { if (null != shutting) { try { shutting.close(); } catch (IOException e) { ; // ignore } } }
From source file:com.kaliturin.blacklist.utils.Utils.java
public static void close(Closeable closeable) { try {//from w w w. j a va 2 s .c o m if (closeable != null) { closeable.close(); } } catch (IOException e) { Log.w(TAG, e); } }
From source file:com.cloudbees.jenkins.plugins.sshagent.jna.AgentServer.java
private static void safelyClose(Closeable channel) { if (channel != null) { try {/*from w ww. j ava2 s. c om*/ channel.close(); } catch (IOException e) { LOGGER.log(Level.INFO, "Error while closing resource", e); } } }
From source file:com.ms.commons.test.common.FileUtil.java
public static void closeCloseAbleQuitly(Closeable closeable) { if (closeable != null) { try {//from w w w . java 2 s. c o m closeable.close(); } catch (IOException e) { // EAT } } }
From source file:com.hazelcast.qasonar.utils.Utils.java
private static void closeQuietly(Closeable closeable) { try {//w ww. j av a 2 s. c o m if (closeable != null) { closeable.close(); } } catch (IOException e) { debugRed("Could not close resource! " + e.getMessage()); } }