io 资料读取通用格式

io 文件读取通用格式public static void main(String[] args) throws IOException{InputStream is new F

io 文件读取通用格式

public static void main(String[] args) throws IOException    {        InputStream is = new FileInputStream("D:\\workspace\\files\\test.txt");                byte[] buff = new byte[1024];                //length:以整数形式返回实际读取的字节数        int length;                while (-1 != (length = is.read(buff, 0, 1024)))        {                        String str = new String(buff, 0, length);            System.out.println(str);        }                is.close();    }
?