Java Stream Close close(Closeable closeable, boolean ignoreException)

Here you can find the source of close(Closeable closeable, boolean ignoreException)

Description

close

License

Apache License

Declaration

public static void close(Closeable closeable, boolean ignoreException) 

Method Source Code

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

import java.io.Closeable;
import java.io.IOException;
import java.io.UncheckedIOException;

public class Main {
    public static void close(Closeable closeable) {
        close(closeable, false);/*from  ww w .j  a  v a 2s .  c  o m*/
    }

    public static void close(Closeable closeable, boolean ignoreException) {
        if (closeable == null) {
            return;
        }
        try {
            closeable.close();
        } catch (IOException e) {
            if (ignoreException == false) {
                throw new UncheckedIOException(e);
            }
        }
    }
}

Related

  1. close(BufferedReader br)
  2. close(BufferedReader br)
  3. close(BufferedWriter bufferedWriter)
  4. close(ClassLoader cl)
  5. close(Closeable bufferedInputStream)
  6. close(Closeable closeable, boolean swallowIOException)
  7. close(Closeable closeable, Logger logger)
  8. close(Closeable io, Logger logger)
  9. close(Closeable resource)