Write byte array to file using BufferedOutputStream : BufferedOutputStream « File « Java Tutorial






import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;

public class Main {

  public static void main(String[] args) throws Exception {
    FileOutputStream fos = new FileOutputStream(new File("C:/Demo"));
    BufferedOutputStream bos = new BufferedOutputStream(fos);
    bos.write("this is a test".getBytes());
    bos.flush();
    bos.close();
  }
}








11.19.BufferedOutputStream
11.19.1.BufferedOutputStream
11.19.2.Create DataOutputStream out of BufferedOutputStream
11.19.3.Create DataInputStream out of BufferedInputStream
11.19.4.Write to file using BufferedOutputStream
11.19.5.Write byte array to file using BufferedOutputStream
11.19.6.Write byte to file using BufferedOutputStream
11.19.7.Append string to a text file