Write byte to file using BufferedOutputStream
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
public class Main {
public static void main(String[] args) throws Exception {
FileOutputStream fos = new FileOutputStream("C:/Demo.txt");
BufferedOutputStream bos = new BufferedOutputStream(fos);
byte b = 66;
// write a character represented by ascii 66 i.e. 'B'
bos.write(b);
bos.flush();
bos.close();
}
}
Related examples in the same category