Java Stream Close closeReader(final Reader reader)

Here you can find the source of closeReader(final Reader reader)

Description

Closes the given reader and swallows exceptions that may arise during the process.

License

Open Source License

Parameter

Parameter Description
reader Reader to close.

Declaration

public static void closeReader(final Reader reader) 

Method Source Code

//package com.java2s;
/* See LICENSE for licensing and NOTICE for copyright. */

import java.io.IOException;

import java.io.Reader;

public class Main {
    /**/*from ww w . j a v  a  2  s .com*/
     * Closes the given reader and swallows exceptions that may arise during the
     * process.
     *
     * @param  reader  Reader to close.
     */
    public static void closeReader(final Reader reader) {
        try {
            reader.close();
        } catch (IOException e) {
            System.err.println("Error closing " + reader + ": " + e);
        }
    }
}

Related

  1. closeQuietly(Writer writer)
  2. closeQuietly(ZipFile closeable)
  3. closeQuietlyWithResult(InputStream sourceInput, boolean suppressionSourceExists)
  4. closeRandomAccessFile()
  5. closeReader(BufferedReader reader)
  6. closeReader(Reader r)
  7. closeReader(Reader reader)
  8. closeReader(Reader reader)
  9. closeReader(Reader rReader)