Java tutorial
//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 { out.write(data); out.flush(); out.close(); } finally { try { out.close(); } catch (IOException ex) { // Do nothing. } } } }