Here you can find the source of writeBytes(File dest, byte[] data, int off, int len, boolean append)
public static void writeBytes(File dest, byte[] data, int off, int len, boolean append) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void writeBytes(byte[] data, String path) throws IOException { writeBytes(touch(path), data);/*from w ww .jav a2s .c o m*/ } public static void writeBytes(File dest, byte[] data) throws IOException { writeBytes(dest, data, 0, data.length, false); } public static void writeBytes(File dest, byte[] data, int off, int len, boolean append) throws IOException { if (dest.exists()) { if (!dest.isFile()) { throw new IOException("Not a file: " + dest); } } FileOutputStream out = null; try { out = new FileOutputStream(dest, append); out.write(data, off, len); } finally { close(out); } } public static File touch(String fullFilePath) throws IOException { if (fullFilePath == null) { return null; } File file = new File(fullFilePath); file.getParentFile().mkdirs(); if (!file.exists()) file.createNewFile(); return file; } public static void close(Closeable closeable) { if (closeable == null) return; try { closeable.close(); } catch (IOException ignored) { } } }