Java tutorial
//package com.java2s; import java.io.FileOutputStream; public class Main { public static void writeString(String file, String content, String charset) { try { byte[] data = content.getBytes(charset); writeBytes(file, data); } catch (Exception e) { System.out.println(e.getMessage()); } } public static boolean writeBytes(String filePath, byte[] data) { try { FileOutputStream fos = new FileOutputStream(filePath); fos.write(data); fos.close(); return true; } catch (Exception e) { System.out.println(e.getMessage()); } return false; } }