Here you can find the source of writeBytesToFile(String strFilePath, byte[] fileData)
public static void writeBytesToFile(String strFilePath, byte[] fileData)
//package com.java2s; //License from project: Apache License import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeBytesToFile(String strFilePath, byte[] fileData) { try {//w w w. j a v a 2s.co m FileOutputStream fos = new FileOutputStream(strFilePath); /* * To write byte array to a file, use * void write(byte[] bArray) method of Java FileOutputStream class. * * This method writes given byte array to a file. */ fos.write(fileData); /* * Close FileOutputStream using, * void close() method of Java FileOutputStream class. * */ fos.close(); } catch (FileNotFoundException ex) { System.out.println("FileNotFoundException : " + ex); } catch (IOException ioe) { System.out.println("IOException : " + ioe); } } }