Java FileOutputStream Create writeFileFromBytes(byte[] bytes, File file)

Here you can find the source of writeFileFromBytes(byte[] bytes, File file)

Description

write File From Bytes

License

Open Source License

Declaration

public static void writeFileFromBytes(byte[] bytes, File file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static void writeFileFromBytes(byte[] bytes, File file) throws IOException {
        OutputStream os = new FileOutputStream(file);

        // Get the size of the file
        long length = bytes.length;

        // Write the file
        os.write(bytes);//from  w  w  w.ja  v  a 2 s. c om

        // Close the input stream and return bytes
        os.close();
        return;
    }
}

Related

  1. writeFileContent(String filepath, byte[] content)
  2. writeFileContent(String sFileName, byte[] content)
  3. writeFileCover(String path, String content)
  4. writeFileData(File dataFile, String targetFile)
  5. writeFileData(File file, byte[] fileData)
  6. writeFileFromStream(File tempFile, InputStream in)
  7. writeFileFromString(File outputFileName, String content)
  8. writeFileRaw(String fileName, byte[][] contents)
  9. writeFileToByte(byte[] bytes, File file)