Java examples for File Path IO:DataOutputStream
Write byte to a file using DataOutputStream
import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) { /* w w w . j av a 2 s .c om*/ String strFilePath = "C://Folder//WriteByte.txt"; try { //create FileOutputStream object FileOutputStream fos = new FileOutputStream(strFilePath); DataOutputStream dos = new DataOutputStream(fos); int i = 1; dos.writeByte(i); dos.close(); } catch (IOException e) { System.out.println("IOException : " + e); } } }