Here you can find the source of writeFile(File file, byte[] context, boolean append)
public static void writeFile(File file, byte[] context, boolean append) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void writeFile(File file, byte[] context, boolean append) throws IOException { FileOutputStream fos = null; if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } else if (append) { fos = new FileOutputStream(file, append); }/*from w w w . j a v a2 s .c o m*/ if (fos == null) { fos = new FileOutputStream(file); } fos.write(context); fos.close(); } public static void writeFile(File file, byte[] context) throws IOException { writeFile(file, context, false); } }