import java.io.*;
public class TestIO {
public static void main(String[] args) {
try (
FileInputStream fis = new FileInputStream("d:/a.txt");
)
{
StringBuilder sb = new StringBuilder();
int temp = 0;
//当temp等于-1时,表示已经到了文件结尾,停止读取
while ((temp = fis.read()) != -1) {
sb.append((char) temp);
}
System.out.println(sb);
} catch (Exception e) {
e.printStackTrace();
}
}
}
(1)read
(2)字符流和字节流的区别
(3)常用流: