Here you can find the source of saveFile(String fileName, byte[] bytes)
public static void saveFile(String fileName, byte[] bytes)
//package com.java2s; //License from project: Open Source License import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void saveFile(String fileName, byte[] bytes) { try {//from w w w. jav a2s . co m FileOutputStream fos = new FileOutputStream(fileName, true); fos.write(bytes); fos.flush(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }