Java Stream Close closeAll()

Here you can find the source of closeAll()

Description

close All

License

Apache License

Declaration

public static void closeAll() 

Method Source Code


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

import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;

import java.util.Map;

public class Main {
    public static final Map<Integer, FileWriter> writers = new HashMap<Integer, FileWriter>();

    public static void closeAll() {
        for (FileWriter fw : writers.values()) {
            try {
                fw.close();/*from   w  w  w.  ja v a2s.c o m*/
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Related

  1. close(ZipFile file)
  2. close(ZipFile file)
  3. close(ZipFile file)
  4. close(ZipFile zipFile)
  5. closeAll()
  6. closeAll(Collection closeables)
  7. closeAll(Exception firstEx, Closeable... objects)
  8. closeAll(Iterable closeables)
  9. closeAll(T... io)