Here you can find the source of saveByteFile(byte[] data, String filePath)
public static void saveByteFile(byte[] data, String filePath) throws IllegalArgumentException, IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void saveByteFile(byte[] data, File file) throws IllegalArgumentException, IOException { if (!file.getParentFile().exists() && !mkDirs(file)) { throw new IllegalArgumentException("Could not create file folder."); }/*from ww w .jav a2s.c om*/ FileOutputStream saveFile = new FileOutputStream(file); saveFile.write(data); saveFile.close(); } public static void saveByteFile(byte[] data, String filePath) throws IllegalArgumentException, IOException { saveByteFile(data, new File(filePath)); } public static boolean mkDirs(File file) { if (file.isDirectory()) return file.mkdirs(); return file.getParentFile().mkdirs(); } }