Here you can find the source of closeIgnoringException(final Closeable closeable)
Parameter | Description |
---|---|
closeable | to close |
public static void closeIgnoringException(final Closeable closeable)
//package com.java2s; //License from project: Open Source License import java.io.Closeable; import java.io.IOException; public class Main { /**/*from w w w. jav a 2 s. com*/ * Closes {@link java.io.Closeable} instance ignoring IOException. Should be called from a finally block whenever {@link java.io.Closeable} is used. * * @param closeable * to close */ public static void closeIgnoringException(final Closeable closeable) { if (closeable == null) return; try { closeable.close(); } catch (IOException ignored) { // We can do nothing if on close failure } } }