List of usage examples for java.io Closeable close
public void close() throws IOException;
From source file:com.wuman.oauth.samples.ui.HtmlLicensesActivity.java
private static void closeSilently(Closeable c) { if (c == null) { return;//from w ww .ja v a 2 s. c o m } try { c.close(); } catch (Throwable t) { // do nothing } }
From source file:Main.java
public static void close(Closeable c, String tag, String message) { if (c != null) { try {/*from w w w. j a v a2s . co m*/ c.close(); } catch (Throwable e) { Log.d(tag, message, e); } } }
From source file:Main.java
private static void closeStream(Closeable stream) { if (stream != null) { try {/* w w w .j a v a2 s. c o m*/ stream.close(); } catch (IOException e) { } } }
From source file:examples.RdfSerializationExample.java
/** * Closes a Closeable and swallows any exceptions that might occur in the * process./*from w w w .j a va 2s . co m*/ * * @param closeable */ static void close(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException ignored) { } } }
From source file:org.eclipse.titan.common.utils.IOUtils.java
/** * Equivalent to Closeable.close(), except any exceptions will be ignored. This is typically used in finally blocks. * * see org.apache.commons.io.IOUtils.closeQuietly() * * @param closeable the objects to close, may be null or already closed *//*from w ww . j ava 2 s . c o m*/ public static void closeQuietly(final Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (final IOException e) { ErrorReporter.logExceptionStackTrace("Error while closing a resource", e); } } }
From source file:de.xwic.appkit.core.util.UStream.java
/** * @param closeables/*from w w w . j a v a 2s . com*/ */ public static void close(final Closeable... closeables) { for (Closeable closeable : closeables) { if (closeable == null) { continue; } try { closeable.close(); } catch (IOException e) { LogFactory.getLog(UStream.class).error("Failed to close stream", e); } } }
From source file:Main.java
@SuppressWarnings("ConstantConditions") public static void close(@Nullable Closeable c) { if (c != null && c instanceof Closeable) { // java.lang.IncompatibleClassChangeError: interface not implemented try {/*from w w w . j av a2s .c o m*/ c.close(); } catch (IOException e) { // silence } } }
From source file:com.nextep.designer.beng.model.impl.FileUtils.java
public static void closeStream(Closeable stream) { if (stream != null) { try {// ww w .j a va 2 s. c om stream.close(); } catch (IOException e) { throw new ErrorException(e); } } }
From source file:Main.java
public static void closeIO(Closeable... closeables) { if (null == closeables || closeables.length <= 0) { return;/* w ww . j a va 2s . c om*/ } for (Closeable cb : closeables) { try { if (null == cb) { continue; } cb.close(); } catch (IOException e) { } } }
From source file:Main.java
/** * Safely close, absorbing exceptions and handling <code>null</code> * graciously./* ww w . j a va2 s. com*/ * * @param object object to close. */ public static void safeClose(Closeable object) { try { if (object != null) { object.close(); } } catch (IOException e) { log(object, e); } }