Here you can find the source of saveBytes(byte[] bytes, String file)
public static final void saveBytes(byte[] bytes, String file) throws IOException
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static final void saveBytes(byte[] bytes, String file) throws IOException { saveBytes(bytes, new File(file)); }/*from w w w .ja va2 s. c o m*/ public static final void saveBytes(byte[] bytes, File file) throws IOException { file.createNewFile(); FileOutputStream out = new FileOutputStream(file); try { saveBytes(bytes, out); } catch (IOException e) { throw e; } finally { out.close(); } } /** this will not close the OutputStream. it may need for further use */ public static final void saveBytes(byte[] bytes, OutputStream out) throws IOException { out.write(bytes); out.flush(); } }