Java InputStream Close close(InputStream is)

Here you can find the source of close(InputStream is)

Description

Close the input stream and trap any exceptions.

License

Academic Free License

Declaration

public static void close(InputStream is) 

Method Source Code

//package com.java2s;
//License from project: Academic Free License 

import java.io.InputStream;

import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;

public class Main {
    /**//from www.ja  v  a  2 s . c o m
     * Close the output stream and trap any exceptions.
     */
    public static void close(OutputStream os) {
        if (os != null) {
            try {
                os.close();
            } catch (Exception ex) {
            }
        }
    }

    public static void close(Writer fw) {
        if (fw != null) {
            try {
                fw.close();
            } catch (Exception ex) {
            }
            ;
        }
    }

    /**
     * Close the input stream and trap any exceptions.
     */
    public static void close(InputStream is) {
        if (is != null) {
            try {
                is.close();
            } catch (Exception ex) {
            }
        }
    }

    /**
     * Close the reader.
     * 
     * @param r
     */
    public static void close(Reader r) {
        if (r != null) {
            try {
                r.close();
            } catch (Exception ex) {

            }
        }
    }
}

Related

  1. close(InputStream input)
  2. close(InputStream inputStream)
  3. close(InputStream inputstream)
  4. close(InputStream inputStream)
  5. close(InputStream is)
  6. close(InputStream is)
  7. close(InputStream is)
  8. close(InputStream is)
  9. close(InputStream is)