Here you can find the source of writeFile0(File file, CharSequence content, Iterable> lines)
private static String writeFile0(File file, CharSequence content, Iterable<?> lines)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { private static String writeFile0(File file, CharSequence content, Iterable<?> lines) { PrintWriter out = null;/* w w w. j a va 2s . c o m*/ try { out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); if (content != null) { out.print(content); } else { for (Object line : lines) { // We could use println, but we'd probably want to make readFile smarter first. out.print(line); out.print("\n"); } } return null; } catch (IOException ex) { return ex.getMessage(); } finally { out.close(); } } }