public static boolean generateItemFile(String fileName, Set<String> set, List<Set> listTree) {
        boolean ret = false;
        BufferedWriter bw = null;
        FileWriter fw = null;
        File file = null;
        PrintWriter pw = null;
        OutputStreamWriter osw = null;

        FileOutputStream fo = null;

        try {

            file = new File(fileName);
            fw = new FileWriter(file);
            fo = new FileOutputStream(file);
            osw = new OutputStreamWriter(fo, code);
            bw = new BufferedWriter(osw);
            //fi=new FileInputStream(fileName);
            //isr=new InputStreamReader(fi,"UTF-8");
            //reader = new BufferedReader(isr);
            int number = 1;

            String str=null;
            if (listTree != null) {
                for (Set s : listTree) {
                    str=s.toString().substring(1,s.toString().length()-1);
                    str=str.replaceAll(", "," ");

                    bw.write(str);
                    bw.newLine();
                }
            }
            if (set != null) {


                for (String s : set) {
                    //System.out.println(s + "-" + map.get(s));
                    bw.write(number++ + ",");
                    bw.write(s);
                    bw.newLine();

                }
            }
            bw.flush();
            ret = true;
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } finally {
            if (bw != null) {
                try {
                    bw.close();
                } catch (IOException e) {
                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                }
            }
            if (fw != null) {
                try {
                    fw.close();
                } catch (IOException e) {
                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                }
            }

        }
        return ret;
    }