Java Stream Close close(Closeable resource)

Here you can find the source of close(Closeable resource)

Description

close

License

Open Source License

Declaration

public static boolean close(Closeable resource) 

Method Source Code


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

import java.io.Closeable;

public class Main {
    public static boolean close(Closeable resource) {
        boolean result = false;

        if (resource != null) {
            try {
                resource.close();/*from   ww  w  .  j  av  a 2s . c o  m*/
                result = true;
            } catch (Exception e) {
                // exception swallowed on purpose
            }
        }

        return result;
    }
}

Related

  1. close(Closeable bufferedInputStream)
  2. close(Closeable closeable, boolean ignoreException)
  3. close(Closeable closeable, boolean swallowIOException)
  4. close(Closeable closeable, Logger logger)
  5. close(Closeable io, Logger logger)
  6. close(Closeable resource)
  7. close(Closeable resource)
  8. close(Closeable resource, File file)
  9. close(Closeable stream)