Here you can find the source of writeFile(byte[] data, String fileName)
public static void writeFile(byte[] data, String fileName) throws IOException
//package com.java2s; /*/* w w w . j a v a 2 s. co m*/ * (C) 2007-2012 Alibaba Group Holding Limited. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * Authors: * leiwen <chrisredfield1985@126.com> , boyan <killme2008@gmail.com> */ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeFile(byte[] data, String fileName) throws IOException { OutputStream out = new FileOutputStream(fileName); out.write(data); out.close(); } public static void writeFile(byte[] data, File file) throws IOException { OutputStream out = new FileOutputStream(file); out.write(data); out.close(); } }