Java tutorial
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(); } }