Java examples for File Path IO:DataOutputStream
Write short type value 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) { String strFilePath = "C://Folder//test.txt"; try {//from www .j a v a 2 s. co m FileOutputStream fos = new FileOutputStream(strFilePath); DataOutputStream dos = new DataOutputStream(fos); short s = 1; dos.writeShort(s); dos.close(); } catch (IOException e) { System.out.println("IOException : " + e); } } }