Here you can find the source of writeFile(String fileName, byte[] bytes)
public static void writeFile(String fileName, byte[] bytes) throws IOException
//package com.java2s; //License from project: Creative Commons License import java.io.*; public class Main { public static void writeFile(String fileName, byte[] bytes) throws IOException { if (fileName.lastIndexOf("/") > 0) new File(fileName).getParentFile().mkdirs(); FileOutputStream fileOut = new FileOutputStream(fileName); fileOut.write(bytes);/*w w w . jav a 2 s . c o m*/ fileOut.close(); } public static void writeFile(String fileName, String data) throws IOException { writeFile(fileName, data.getBytes("UTF-8")); } }