Java examples for File Path IO:UTF
Helper function to write UTF-8 files
//package com.java2s; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; public class Main { /**/* w w w. j ava 2s . c o m*/ * Helper function to write files * * @param FileName * The file to write to * @param content * Content to write in the file */ public static void printFile(String FileName, String content) { PrintWriter writer; try { writer = new PrintWriter(FileName, "UTF-8"); writer.print(content); writer.close(); } catch (FileNotFoundException | UnsupportedEncodingException e) { e.printStackTrace(); } } }