Here you can find the source of writeFile(File file, byte[] content)
private static void writeFile(File file, byte[] content) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 R?diger Herrmann and others. All rights reserved. * 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 ww w .j av a 2s. c om * R?diger Herrmann - initial API and implementation ******************************************************************************/ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static void writeFile(File file, byte[] content) throws IOException { FileOutputStream outputStream = new FileOutputStream(file, false); try { for (int i = 0; i < content.length; i++) { outputStream.write(content[i]); } } finally { outputStream.close(); } } }