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(); }
io 文件读取通用格式
最新推荐文章于 2023-08-22 19:39:33 发布