Here you can find the source of writeFile(File file, byte[] data)
public static void writeFile(File file, byte[] data) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeFile(File file, byte[] data) throws IOException { OutputStream out = new FileOutputStream(file); try {// w ww . ja va 2 s .c o m out.write(data); out.flush(); out.close(); } finally { try { out.close(); } catch (IOException ex) { // Do nothing. } } } }