So I can read a text file with Java
like this just fine:
File file = new File("C:/text.txt");
Scanner scanner = new Scanner(file,"utf-8");
while (scanner.hasNext()) {
scanner.nextLine();
// rest of the code...
I am not 100% sure but I believe this loads the whole file and then reads the text line by line.
Suppose you have a very large text file where one line might be way too long.
How can I read the text from the file, say like 50 characters per time? What I want is in every iteration I should get 50 characters, not more.