知识点:
1.什么叫瞬时数据,什么叫持久数据?
顺势数据:存在内存里面的数据,程序结束消失了
持久数据:存在硬盘里面的数据,通过文件或者数据库保存
2.列出File类中常用的方法并解释?(3种以上)
创建文件:file.createNewFile()
判断是否存在:exists()
判断是文件夹:isDirector()
isFile()
delete()
mkdirs()
getName() 获取文件名
getPath()
getAbsolutePath()绝对路径
File[] files = file.listFiles() 获取文件夹中的所有文件
3.流按照流向可以分为哪两类,依据的是什么。
输入流: 数据进入内存
输出流: 数据从内存流出
4.FileInputStream类几种创建对象的方式?读取文件的方法有几个?
new FileInputStream(String path)
new FileInputStream(File file)
read()
read(byte[] bytes)
read(byte[] bytes,int pos,int length)
5.FileOutputStream类几种创建对象的方式?FileOutputStream类写入文件的方法有几种?
new FileOutputStream(String path)
new FileOutputStream(File file)
new FileOutputStream(String path,boolean append)
write(int data)
write(byte [] bytes)
write(byte[] bytes,int pos,int length)
6.写出输入流和输出流的基类。
字节:
输入流: InputStream
输出流: OutputStream
字符:
输入流: Reader
输出流: Writer



