List of usage examples for java.io Closeable close
public void close() throws IOException;
From source file:com.todotxt.todotxttouch.util.Util.java
public static void closeStream(Closeable stream) { if (stream != null) { try {// w w w . j a v a 2s. c o m stream.close(); stream = null; } catch (IOException e) { Log.w(TAG, "Close stream exception", e); } } }
From source file:org.solenopsis.checkstyle.utils.CommonUtils.java
/** * Closes a stream re-throwing IOException as IllegalStateException. * * @param closeable// w w w . ja v a2 s . com * Closeable object */ public static void close(Closeable closeable) { if (closeable == null) { return; } try { closeable.close(); } catch (IOException ex) { throw new IllegalStateException("Cannot close the stream", ex); } }
From source file:org.apache.felix.http.itest.BaseIntegrationTest.java
protected static void close(Closeable resource) { if (resource != null) { try {/*from w w w.ja va 2s. c o m*/ resource.close(); } catch (IOException e) { // Ignore... } } }
From source file:org.apache.jena.atlas.io.IO.java
public static void closeSilent(java.io.Closeable resource) { if (resource == null) return;//from w ww .ja v a 2 s .c o m try { resource.close(); } catch (IOException ex) { } }
From source file:org.apache.jena.atlas.io.IO.java
public static void close(java.io.Closeable resource) { if (resource == null) return;/*from www. ja va 2 s . com*/ try { resource.close(); } catch (IOException ex) { exception(ex); } }
From source file:org.jboss.loom.utils.as7.AS7CliUtils.java
/** * Safely closes closeable resource (a CLI connection in our case). *///from w w w .j a va2s . c o m public static void safeClose(final Closeable closeable) { if (closeable != null) try { closeable.close(); } catch (IOException e) { //throw new MigrationException("Closing failed: " + e.getMessage(), e); } }
From source file:com.segment.analytics.internal.Utils.java
/** * Close the given {@link Closeable}. If an exception is thrown during {@link Closeable#close()}, * this will quietly ignore it. Does nothing if {@code closeable} is {@code null}. */// w w w . ja va 2s . c o m public static void closeQuietly(Closeable closeable) { if (closeable == null) return; try { closeable.close(); } catch (IOException ignored) { } }
From source file:com.ibm.stocator.fs.common.Utils.java
public static void closeWithoutException(Closeable is) { if (is != null) { try {/*from www .j ava2 s .c om*/ is.close(); } catch (IOException ex) { LOG.debug("Ignore failure in closing the Closeable", ex); } } }
From source file:org.opencastproject.util.IoSupport.java
/** * Closes a <code>Closable</code> quietly so that no exceptions are thrown. * * @param s// ww w . j a va 2 s . c o m * maybe null */ public static boolean closeQuietly(final Closeable s) { if (s == null) { return false; } try { s.close(); return true; } catch (IOException e) { return false; } }
From source file:com.sk89q.squirrelid.util.HttpRequest.java
private static void closeQuietly(Closeable closeable) { try {//from w w w .jav a2s . c om closeable.close(); } catch (IOException ignored) { } }