Write to file using Buffered Stream in Java
Description
The following code shows how to write to file using Buffered Stream.
Example
/* w ww. j a va 2 s . c o m*/
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
public class Main {
public static void main(String[] args) throws Exception {
BufferedOutputStream bufferedOutput = new BufferedOutputStream(new FileOutputStream(
"yourFile.txt"));
bufferedOutput.write("Line one".getBytes());
bufferedOutput.write("\n".getBytes());
bufferedOutput.write(65);
bufferedOutput.close();
}
}