java读写

BufferedOutputStream Buff=new BufferedOutputStream(new FileOutputStream(new File(“C:/add0.txt”))); 

Buff.write(“测试java 文件操作\r\n”.getBytes()); 

Buff.flush(); 

Buff.close();


BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("ming.txt")));
String data = null;
while((data = br.readLine())!=null)
{
System.out.println(data); 
}

你可能感兴趣的:(编程语言)