Here you can find the source of closeNoExceptions(Reader reader)
public static void closeNoExceptions(Reader reader)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009 Clark N. Hobbie/*www .j a v a2 s. com*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Clark N. Hobbie - initial API and implementation *******************************************************************************/ import java.io.BufferedReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; public class Main { public static void closeNoExceptions(Reader reader) { if (null == reader) return; try { reader.close(); } catch (IOException e) { ; // ignore exceptions } } public static void closeNoExceptions(BufferedReader reader) { if (null == reader) return; try { reader.close(); } catch (IOException e) { ; // this method is supposed to ignore exceptions } } public static void closeNoExceptions(InputStream istream) { if (null == istream) return; try { istream.close(); } catch (IOException e) { ; // this method is supposed to ignore exceptions } } public static void closeNoExceptions(FileWriter writer) { if (null == writer) return; try { writer.close(); } catch (IOException e) { ; // the point of this method is to avoid throwing exceptions } } public static void closeNoExceptions(OutputStream ostream) { try { ostream.close(); } catch (IOException e) { ; } } }