Java Stream Close close(java.io.Closeable in)

Here you can find the source of close(java.io.Closeable in)

Description

Closes a stream, handling all exceptions

License

Open Source License

Parameter

Parameter Description
in a parameter

Declaration

public static void close(java.io.Closeable in) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*w  w  w  .ja  v  a  2  s.  c  om*/
     * Closes a stream, handling all exceptions
     * @param in
     */
    public static void close(java.io.Closeable in) {
        if (in == null)
            return;

        try {
            in.close();
        } catch (Exception e) {
            // do nothing
        }
    }
}

Related

  1. close(final Logger logger, final Closeable... closeables)
  2. close(final Object stream)
  3. close(final OutputStream dest)
  4. close(final Scanner scanner)
  5. close(Iterator iterator)
  6. close(JMXConnector connector)
  7. close(Object obj)
  8. close(Object resource)
  9. close(ObjectInput in)