http://www.verejava.com/?id=16994690613914
Package Com.io2;import java.io.*;p ublic class testdatainputstream{public static void Main (string[] args) {O Utputstream OS; try {//to the file in int, Double,boolean, String to Data OS = new FileOutputStream ("Res/data . Dat ")); DataOutputStream dos=new dataoutputstream (OS); Dos.writeutf ("Zhang San"); Dos.writeint (20); Dos.writeboolean (TRUE); Dos.writedouble (10.2); Os.flush ();//Deposit File//Get Data InputStream is=new fileinputstream (New file ("Res/data.dat")); DataInputStream dis=new DataInputStream (IS); Note that the order of data must be the same as the stored data System.out.println (DIS.READUTF ()); System.out.println (Dis.readint ()); System.out.println (Dis.readboolean ()); System.out.println (Dis.readdouble ()); } catch (Exception e) {e.printstacktrace (); } }}
http://www.verejava.com/?id=16994690613914
Java io stream DataInputStream dataoutputstream