Here you can find the source of closeAll()
public static void closeAll()
//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(); } } } }