Here you can find the source of saveBytes(File f, byte[] content)
public static void saveBytes(File f, byte[] content) throws IOException
//package com.java2s; //License from project: LGPL import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static final int BUF_SIZE = 65536; public static void saveBytes(File f, byte[] content) throws IOException { FileOutputStream os = null; ByteArrayInputStream bais = null; try {/*from ww w . j a v a2 s . c o m*/ os = new FileOutputStream(f); bais = new ByteArrayInputStream(content); byte[] buf = new byte[BUF_SIZE]; while (true) { int rc = bais.read(buf); if (rc <= 0) break; else os.write(buf, 0, rc); } } finally { if (os != null) os.close(); if (bais != null) bais.close(); } } }