Here you can find the source of saveBytes(byte[] bytes, File file)
Parameter | Description |
---|---|
bytes | the binary data to be saved |
file | the destination file |
public static void saveBytes(byte[] bytes, File file) throws IOException
//package com.java2s; import java.io.IOException; import java.io.File; import java.io.OutputStream; import java.io.FileOutputStream; public class Main { /**// w w w . j a va 2 s .c o m * Saves binary data to a file. * * @param bytes the binary data to be saved * @param file the destination file * @exception IOException if there is an I/O problem */ public static void saveBytes(byte[] bytes, File file) throws IOException { OutputStream out = new FileOutputStream(file); try { out.write(bytes, 0, bytes.length); out.flush(); } finally { out.close(); } } }