IO
File 类用来获取文件或者目录属性
InputStream is=new FileInputStream("路径")
int length=is.read(字节数组)
is.close();
OutputStream os=new FileOutputStream("路径")
os.write(字节数组)
os.close();
Reader r=new FileReader("路径")
int length=r.read(字符数组);
r.close();
Write w=new FileWriter("路径");
w.write(内容);
w.close();
File 类用来获取文件或者目录属性
InputStream is=new FileInputStream("路径")
int length=is.read(字节数组)
is.close();
OutputStream os=new FileOutputStream("路径")
os.write(字节数组)
os.close();
Reader r=new FileReader("路径")
int length=r.read(字符数组);
r.close();
Write w=new FileWriter("路径");
w.write(内容);
w.close();
本文介绍了Java中常用的IO操作,包括使用File类获取文件或目录属性,通过FileInputStream和FileOutputStream进行字节流读写,利用FileReader和FileWriter实现字符流的读写操作。
1万+

被折叠的 条评论
为什么被折叠?



