Create BufferedOutputStream from FileOutputStream : BufferedOutputStream « File Input Output « Java






Create BufferedOutputStream from FileOutputStream

  

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

class BufferedOutputStreamDemo {

  public static void main(String args[]) throws Exception {
    FileOutputStream fos = new FileOutputStream(args[0]);

    BufferedOutputStream bos = new BufferedOutputStream(fos);

    // Write 12 bytes to the file
    for (int i = 0; i < 12; i++) {
      bos.write(i);
    }

    bos.close();
  }
}

   
    
  








Related examples in the same category

1.Write to file using BufferedOutputStream
2.Write byte array to file using BufferedOutputStream
3.Write byte to file using BufferedOutputStream
4.Fast BufferedOutputStream