import java.io.FileInputStream;标签:字符,1216,java,read,isr,读数据,io,xs,FileInputStream From: https://blog.51cto.com/u_13137233/5947476
import java.io.IOException;
import java.io.InputStreamReader;
public class Test3 {
public static void main(String[] args) throws IOException {
// 字节输入流
FileInputStream xs = new FileInputStream("小说.txt");
// 字符输出流
InputStreamReader isr = new InputStreamReader(xs);
// 反复的读数据,直到没有数据
int read = isr.read();
while (read != -1) {
// 把read的编号转成字符
char c = (char) read;
// 输出
System.out.print(c);
// 再读一次
read = isr.read();
}
// 关闭资源
xs.close();
isr.close();
}
}