import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.FileInputStream;
public class MyClass {
public static void main(String[] args) {
FileInputStream reader = null;
try{
reader = new FileInputStream("d:\\123.txt");
while(true){
int read_int = reader.read();
if(read_int == -1) break;
char ch = (char) read_int;
System.out.println(ch);
}
} catch(FileNotFoundException e1) {
System.out.println("File not Found");
} catch(EOFException e2){
System.out.println("File ended.");
} catch(IOException e3){
e3.printStackTrace();
}
finally{
try{
reader.close();
} catch (NullPointerException e1){
System.out.println("NullPointerException caught.");
} catch (IOException e2){
System.out.println("IOException caught.");
}
}
}
}
В файле 123.txt текст на русском. В консоль выводятся непонятные символы.