Try a Scannerclass that no one knows about, but can do almost anything with text.
To get a reader for a file, use
File file = new File ("...path...");
String encoding = "....";
Reader reader = new BufferedReader (new InputStreamReader (
new FileInputStream (file), encoding));
... use reader ...
reader.close ();
You must really specify the encoding, otherwise you will get strange results when you encounter umlauts, Unicode, etc.
source
share