public class TestEOF {
public static void main(String[] args) 
throws IOException{
DataInputStream in = new DataInputStream(
new BufferedInputStream(
new FileInputStream("src/io/TestEOF.java")));
while(in.available() != 0)
System.out.print((char)in.readByte());
}
}
为什么要(char)in.readByte()
当我用in.readChar()时就会出现乱码?
而这个文件本身就是字符,我感觉用的方法不会出现乱码,用它的方法会乱码,而事实证明我是错的。IO乱码