Here you can find the source of writeBytesToFile(byte[] data, String path)
public static boolean writeBytesToFile(byte[] data, String path)
//package com.java2s; /*/*from w w w.j a v a 2s . co m*/ * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. */ import java.io.*; public class Main { /** * @return true on success. */ public static boolean writeBytesToFile(byte[] data, String path) { if (path != null) { return writeBytesToFile(data, new File(path)); } return false; } /** * @return true on success. */ public static boolean writeBytesToFile(byte[] data, File file) { try { FileOutputStream fos = new FileOutputStream(file); fos.write(data); fos.close(); return true; } catch (IOException ioe) { return false; } } }