Java Write Byte Array to File writeFile(File file, byte[] content)

Here you can find the source of writeFile(File file, byte[] content)

Description

write File

License

Open Source License

Declaration

private static void writeFile(File file, byte[] content) throws IOException 

Method Source Code

//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();
        }
    }
}

Related

  1. writeFile(byte[] data, String path, boolean overwrite)
  2. writeFile(byte[] fileData, String path)
  3. writeFile(byte[] outputBytes, String outputFile)
  4. writeFile(File f, byte[] data)
  5. writeFile(File file, byte[] b)
  6. writeFile(File file, byte[] context, boolean append)
  7. writeFile(File file, byte[] data)
  8. writeFile(File file, byte[] data)
  9. writeFile(File file, byte[] data)