Here you can find the source of writeFileByBytes(String content, String filename)
public static void writeFileByBytes(String content, String filename) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeFileByBytes(String content, String filename) throws IOException { File file = new java.io.File(filename); OutputStream out = null;/*from w w w . j a v a2s. c o m*/ try { out = new FileOutputStream(file, true); byte[] bytes = content.getBytes(); out.write(bytes); } catch (Exception e) { e.printStackTrace(); } finally { if (out != null) { try { out.close(); } catch (Exception e2) { } } } } }