Java FileOutputStream Write Byte Array writeBytesToFile(byte[] byteContent, String fileName)

Here you can find the source of writeBytesToFile(byte[] byteContent, String fileName)

Description

* Output Bytes to file ******************************************.

License

Open Source License

Parameter

Parameter Description
byteContent the byte content
fileName the file name

Exception

Parameter Description
Exception the exception

Declaration

public static void writeBytesToFile(byte[] byteContent, String fileName) throws Exception 

Method Source Code


//package com.java2s;
import java.io.File;
import java.io.FileOutputStream;

public class Main {
    /**//  www .ja v a2  s .  c o m
     * *****************************************
     * Output Bytes to file
     * ******************************************.
     *
     * @param byteContent the byte content
     * @param fileName the file name
     * @throws Exception the exception
     */
    public static void writeBytesToFile(byte[] byteContent, String fileName) throws Exception {

        File kekFile = new File("c:\\temp\\" + fileName);
        FileOutputStream f = new FileOutputStream(kekFile);
        f.write(byteContent);
        f.close();
    }
}

Related

  1. writeBytes(String filename, byte[] data, int len)
  2. writeBytes(String filePath, boolean append, byte[] content)
  3. writeBytesInFile(File f, String data)
  4. writeBytesSafely(File aFile, byte theBytes[])
  5. writeBytesToFile(byte[] bfile, String filePath, String fileName)
  6. writeBytesToFile(byte[] bytes, File file)
  7. writeBytestoFile(byte[] bytes, String filepath)
  8. writeBytesToFile(byte[] data, String path)
  9. writeBytesToFile(File destination, byte[] bytes)