Java Stream Close closeReader(Reader reader)

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

Description

Close the given Java IO Reader and ignore any thrown exception.

License

Apache License

Parameter

Parameter Description
reader a parameter

Declaration

public static void closeReader(Reader reader) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    /**/* www  . j a  v  a 2s .  c o m*/
     * Close the given Java IO Reader and ignore any thrown exception. This is
     * useful for typical finally blocks in manual io code.
     *
     * @param reader
     */
    public static void closeReader(Reader reader) {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (Throwable ex) {
                ex.printStackTrace();
            }
        }
    }
}

Related

  1. closeQuietlyWithResult(InputStream sourceInput, boolean suppressionSourceExists)
  2. closeRandomAccessFile()
  3. closeReader(BufferedReader reader)
  4. closeReader(final Reader reader)
  5. closeReader(Reader r)
  6. closeReader(Reader reader)
  7. closeReader(Reader rReader)
  8. closeRelaxed(Closeable resource)
  9. closeReportFile()