一:文件读写操作

一:文件读写操作
1.JAVA io :输入输出操作:一组有序的,起点,终点字节的集合;对数据传输总称
2.读取磁盘数据,网络数据,输入输出
3.缓冲区技术
4.字节,字符,
5.inputstrean:抽象类
6.outputstream,out
7.system.in
8.systetm.out
二。文件自身
1.文件操作类
2.fileinputsream fin=new fileinutstream(“f:a.text”)
3.read():每次读一个字节:返回值-1文件末尾
4.while((ch=fin。read())!=-1)
(char)ch
byte buff []=new byte [1024];
while(fin.read(buff)!=-1)
new String (buff):字符串
文件读取完毕流:close
public static void main (String【】args)throws Exception{
fileoutputstream fos=new fileoutputstream(“f://a.txt”);
String str =“hello JAVA !”
fos.write (str getBytes());
fos.close();
system.out.println(“end…”);
}
}

猜你喜欢

转载自blog.csdn.net/weixin_45799690/article/details/103691125
今日推荐