高效流:
1.字节流
BufferedInputStream
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File("")));
BufferedOutputStream
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File("")))
2.字符流
BufferedReader br = new BufferedReader(new FileReader(new File("地址")))
br.readLine()
注意:返回值结果是String 如果读取到最后一行 null
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("写出去的地址")))
bw.newLine()
3.转换流(在操作文本时需要去指定对应的码表)
InputStreamReader
OutputStreamWriter
InputStreamReader isr = new InputStreamReader(new FileInputStream(new File()),"编码表")
|
|