import java.io.FileInputStream;import java.io.IOException;import java.io.InputStreamReader;public class Test4 { public static void main(String[] args) throws IOException { // 获得字节输入流 FileInputStream xs = new FileInputStream("小
import java.io.FileInputStream;import java.io.IOException;import java.io.InputStreamReader;public class Test4 { public static void main(String[] args) throws IOException { // 获得字节输入流 FileInputStream xs = new FileInputStream("小说.txt"); // 获得字符输入流 InputStreamReader isr = new InputStreamReader(xs); // 获得一个字符容器 char[] chars = new char[4]; // 开始遍历读数据 int len = isr.read(chars); while (len != -1) { // 从容器中取数据 String msg = new String(chars, 0, len); System.out.print(msg); len = isr.read(chars); } // 关闭资源 xs.close(); isr.close(); // 程序结束 System.out.println("game over"); }}