Java FileOutputStream Write Byte Array writeBytes(File file, byte[] bytes, boolean append)

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

Description

write Bytes

License

Open Source License

Declaration

public static void writeBytes(File file, byte[] bytes, boolean append) throws Exception 

Method Source Code

//package com.java2s;

import java.io.File;

import java.io.FileOutputStream;

import java.io.IOException;

public class Main {
    public static void writeBytes(File file, byte[] bytes, boolean append) throws Exception {
        try {//w  ww  . j av a 2s  . c  om
            FileOutputStream stream = new FileOutputStream(file, append);
            stream.write(bytes);
            stream.flush();
            stream.close();
        } catch (IOException t) {
            throw new Exception("could not write to " + file + ": " + new String(bytes), t);
        }
    }
}

Related

  1. writeBytes(File file, byte[] ba)
  2. writeBytes(File file, byte[] bytes)
  3. writeBytes(File file, byte[] bytes)
  4. writeBytes(File file, byte[] bytes)
  5. writeBytes(File file, byte[] bytes)
  6. writeBytes(File file, byte[] data)
  7. writeBytes(File file, byte[] pattern, int repeat)
  8. writeBytes(File file, byte[] source, int offset, int len)
  9. writeBytes(File filename, byte[] contents)