List of usage examples for java.io Closeable close
public void close() throws IOException;
From source file:de.xwic.sandbox.base.model.util.StreamUtil.java
/** * @param closable/*from ww w . ja v a 2 s. c om*/ * @param log */ public static void close(Log log, Closeable... closables) { for (Closeable closable : closables) { if (closable != null) { try { closable.close(); } catch (IOException e) { log.error(e.getMessage(), e); } } } }
From source file:Main.java
/** * Closes the specified stream./* w w w.ja v a 2s . c o m*/ * * @param stream The stream to close. */ private static void closeStream(Closeable stream) { if (stream != null) { try { stream.close(); } catch (IOException e) { android.util.Log.e(TAG, "Could not close stream", e); } } }
From source file:org.sejda.util.IOUtils.java
/** * Null safe close of the given {@link Closeable} suppressing any exception. * * @param closeable/* ww w. ja va 2 s.c om*/ * to be closed */ public static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (IOException ioe) { LOG.warn("An error occured while closing a Closeable resource", ioe); } }
From source file:Main.java
public static void close(Closeable... closeables) { if (closeables == null || closeables.length == 0) return;// www .j a va 2 s . c o m for (Closeable closeable : closeables) { if (closeable != null) { try { closeable.close(); } catch (IOException e) { e.printStackTrace(); } } } }
From source file:Main.java
public static void closeQuietly(Closeable closeable) { try {// ww w . java 2s. c o m if (closeable != null) { closeable.close(); } } catch (IOException var2) { ; } }
From source file:org.kiji.schema.util.Resources.java
/** * Does the best it can to close the resource. Logs a warning on IOException. * * @deprecated Use org.apache.commons.io.IOUtils.closeQuietly(Closeable) instead. * * @param resource The resource to close. *//* w ww. j a v a 2s . c o m*/ @Deprecated public static void closeResource(Closeable resource) { try { if (null != resource) { resource.close(); } } catch (IOException ioe) { LOG.warn("Error closing resource: " + resource); LOG.warn(ioe.getMessage()); } }
From source file:Main.java
/** * Closes the specified stream.// w w w .j av a 2 s . co m * * @param stream The stream to close. */ private static void closeStream(Closeable stream) { if (stream != null) { try { stream.close(); } catch (IOException e) { Log.e(TAG, "Could not close stream", e); } } }
From source file:org.apache.pulsar.io.file.utils.GZipFiles.java
private static void closeSafely(Closeable closeable) { if (closeable != null) { try {//from www.ja v a 2 s . co m closeable.close(); } catch (IOException e) { // Ignore } } }
From source file:Main.java
public static void closeQuietly(Closeable closeable) { if (closeable == null) { return;// w w w. ja va 2s. c om } try { closeable.close(); } catch (IOException ioe) { // ignore } }
From source file:com.amazonaws.client.util.sdk.IOUtils.java
/** * Closes the given Closeable quietly.//from ww w. j a v a2 s. c o m * @param is the given closeable * @param log logger used to log any failure should the close fail */ public static void closeQuietly(Closeable is, Log log) { if (is != null) { try { is.close(); } catch (IOException ex) { Log logger = log == null ? defaultLog : log; if (logger.isDebugEnabled()) logger.debug("Ignore failure in closing the Closeable", ex); } } }