public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("d:/test/hello.txt");
int data;
System.out.println("可读取的字节数:" + fis.available());
// 将字节转换成字符串输出
while ((data = fis.read()) != -1) {
char c = (char) data;
System.out.println(c);
}
// 关闭流
fis.close();
}
控制台输出内容: