Here you can find the source of writeFile(byte[] bytes, File file)
public static void writeFile(byte[] bytes, File file)
//package com.java2s; /****************************************************************************** * Copyright (c) 2012 Masatomi KINO and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * Contributors://from w w w. jav a 2 s. c o m * Masatomi KINO - initial API and implementation * $Id$ ******************************************************************************/ import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeFile(byte[] bytes, File file) { BufferedOutputStream stream = null; try { FileOutputStream fstream = new FileOutputStream(file); stream = new BufferedOutputStream(fstream); stream.write(bytes); } catch (IOException e) { e.printStackTrace(); } finally { if (stream != null) { try { stream.close(); } catch (IOException e1) { e1.printStackTrace(); } } } } }