Here you can find the source of writeBytes(File file, byte[] data)
private static void writeBytes(File file, byte[] data) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { private static void writeBytes(File file, byte[] data) throws IOException { OutputStream fos = null;/*from ww w .ja v a 2 s . c om*/ OutputStream os = null; try { fos = new FileOutputStream(file); os = new BufferedOutputStream(fos); os.write(data); } finally { try { if (os != null) os.close(); if (fos != null) fos.close(); } catch (Exception e) { System.out.println(e); } } } }