Here you can find the source of writeFile(File f, byte[] data)
public static void writeFile(File f, byte[] data)
//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; import java.io.RandomAccessFile; public class Main { public static void writeFile(File f, byte[] data) { try {//from www .j a v a 2 s .com RandomAccessFile raf = new RandomAccessFile(f, "rw"); try { raf.write(data); } finally { raf.close(); } } catch (IOException e) { e.printStackTrace(); } } public static void writeFile(byte[] data, String fileName) throws IOException { OutputStream out = new FileOutputStream(fileName); out.write(data); out.close(); } }