Java Stream Close closeAll(T... io)

Here you can find the source of closeAll(T... io)

Description

close All

License

Open Source License

Declaration

public static <T extends Closeable> void closeAll(T... io) 

Method Source Code


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

import java.io.Closeable;

public class Main {

    public static <T extends Closeable> void closeAll(T... io) {
        for (Closeable temp : io) {
            try {
                if (null != temp) {
                    temp.close();// w  ww . j a v a2s . c om
                }
            } catch (Exception e) {
            }
        }
    }

    public static void close(Closeable... io) {
        for (Closeable temp : io) {
            try {
                if (null != temp) {
                    temp.close();
                }
            } catch (Exception e) {
            }
        }

    }
}

Related

  1. closeAll()
  2. closeAll()
  3. closeAll(Collection closeables)
  4. closeAll(Exception firstEx, Closeable... objects)
  5. closeAll(Iterable closeables)
  6. closeAllStreamsQuietly(final Closeable... closeables)
  7. closeAndRethrow(final Exception e, final Closeable... channels)
  8. closeBufferedFile(BufferedReader reader)
  9. closeBufferedReader(BufferedReader bufferedReader)