Here you can find the source of closeIgnoringExceptions(Closeable c)
Parameter | Description |
---|---|
c | The IO resource to close (e.g., a Stream/Reader) |
public static void closeIgnoringExceptions(Closeable c)
//package com.java2s; import java.io.*; public class Main { /**//from www . j a va 2 s.c om * Provides an implementation of closing a file for use in a finally block so * you can correctly close a file without even more exception handling stuff. * From a suggestion in a talk by Josh Bloch. * * @param c The IO resource to close (e.g., a Stream/Reader) */ public static void closeIgnoringExceptions(Closeable c) { if (c != null) { try { c.close(); } catch (IOException ioe) { // ignore } } } }