If you need to use Scanner (as you noted in your editing), try the following:
myScanner.useDelimiter("(?<=.)");
Now myScanner should read character by character.
Instead, you can use the BufferedReader (if you can) - it has a read that reads one character. For example, this will read and print the first character of your file:
BufferedReader br = new BufferedReader(new FileReader("somefile.txt")); System.out.println((char)br.read()); br.close();
arshajii
source share