Java Stream Close closeWithoutError(Object close)

Here you can find the source of closeWithoutError(Object close)

Description

close the Closeable object, without any exception.

License

Open Source License

Parameter

Parameter Description
close a parameter

Declaration

public static void closeWithoutError(Object close) 

Method Source Code

//package com.java2s;

import java.io.Closeable;

public class Main {
    /**/*  w w w  . j  a  v a2  s.co m*/
     * close the Closeable object, without any exception.
     * @param close
     * @author <a href="mailto:iffiff1@gmail.com">Tyler Chen</a> 
     * @since Aug 18, 2015
     */
    public static void closeWithoutError(Object close) {
        try {
            if (close == null) {
                return;
            }
            if (close instanceof Closeable) {
                ((Closeable) close).close();
            }
        } catch (Exception e) {
        }
    }
}

Related

  1. closeStreams(InputStream src, OutputStream dest)
  2. closeStreams(Process process)
  3. closeUnchecked(InputStream stream)
  4. closeWarnOnError(Closeable stream, Logger log, String message)
  5. closeWhileHandlingException(Closeable... objects)
  6. closeWithRuntimeException(Closeable c)
  7. closeWriteFile(FileOutputStream fileoutputstream)
  8. closeWriter(final Writer writer)
  9. closeWriter(PrintWriter pw)