Java Stream Close closeEL(InputStream is)

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

Description

close inputstream without a Exception

License

LGPL

Parameter

Parameter Description
is a parameter

Declaration

public static void closeEL(InputStream is) 

Method Source Code

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

import java.io.InputStream;

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

public class Main {
    /**/*from   ww w  .  ja va2s.com*/
     * close inputstream without a Exception
     * @param is 
     * @param os 
     */
    public static void closeEL(InputStream is, OutputStream os) {
        closeEL(is);
        closeEL(os);
    }

    /**
     * close inputstream without a Exception
     * @param is 
     */
    public static void closeEL(InputStream is) {
        try {
            if (is != null)
                is.close();
        } catch (Throwable e) {
        }
    }

    /**
     * close reader without a Exception
     * @param is 
     */
    public static void closeEL(Reader r) {
        try {
            if (r != null)
                r.close();
        } catch (Throwable e) {
        }
    }

    /**
    * close reader without a Exception
    * @param is 
    */
    public static void closeEL(Writer w) {
        try {
            if (w != null)
                w.close();
        } catch (Throwable e) {
        }
    }

    /**
     * close outputstream without a Exception
     * @param os 
     */
    public static void closeEL(OutputStream os) {
        try {
            if (os != null)
                os.close();
        } catch (Throwable e) {
        }
    }
}

Related

  1. closeBufferedReader(BufferedReader bufferedReader)
  2. closeCloseableIfNotNull(Closeable fileWriter)
  3. closeConnection(Closeable... closes)
  4. closeDataLine(final SourceDataLine line, final AudioInputStream ais)
  5. closeDebugFile()
  6. closeEntry(ZipOutputStream... outputStreams)
  7. closeFile()
  8. closeFile()
  9. closeFile(File file, boolean toBeDeleted)