Here you can find the source of writeBytes(File file, byte[] source, int offset, int len)
public static void writeBytes(File file, byte[] source, int offset, int len) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeBytes(String filename, byte[] source) throws IOException { if (source == null) { return; }/*w ww. java2 s . co m*/ writeBytes(new File(filename), source, 0, source.length); } public static void writeBytes(File file, byte[] source) throws IOException { if (source == null) { return; } writeBytes(file, source, 0, source.length); } public static void writeBytes(String filename, byte[] source, int offset, int len) throws IOException { writeBytes(new File(filename), source, offset, len); } public static void writeBytes(File file, byte[] source, int offset, int len) throws IOException { if (len < 0) { throw new IOException("File size is negative!"); } if (offset + len > source.length) { len = source.length - offset; } FileOutputStream fos = null; try { fos = new FileOutputStream(file); fos.write(source, offset, len); } finally { if (fos != null) { fos.close(); } } } }