Here you can find the source of saveFile(String path, byte[] content)
public static void saveFile(String path, byte[] content) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static void saveFile(String path, byte[] content) throws IOException { try {/*w w w . j a v a 2s. c o m*/ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(content); try (OutputStream outputStream = new FileOutputStream(path)) { int data; while ((data = byteArrayInputStream.read()) != -1) { outputStream.write(data); } } } catch (IOException e) { throw e; } } }