日期:2014-05-20 浏览次数:20744 次
import java.io.DataOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class TestDataOutputStream1007 { public static void main(String[] args) { try { DataOutputStream dos = new DataOutputStream(new FileOutputStream( new File("F:/testIO/data.txt"))); dos.writeInt(25); dos.writeBoolean(true); dos.writeFloat(12.25f); dos.writeUTF("疏影横斜水清浅"); dos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }