I have a use case where I need to read a text file read a text file (possibly quite a large one) into an InputStream and then display the contents to the System.out.
Simple enough, I am using the 1.6 Console class to access it's, which is pretty much -> PrintWriter.println(mytext). This works fine, except that the entire contents are just dumped to the screen, which is pretty silly for a very large text file since there would be no way to read it all.
What I want to be able to do is limit the amount of the text file getting dumped to the screen so that the user can read it and effectively "click" through it by hitting enter or any other key. Basically, paging through the text until it's all written to the screen.
Are they any handy algorithms around that can format the large
String into something that PrintWriter can handle in this way?
I have a few ideas but don't want to re-invent the wheel.