How can I read 20 characters of a text file progressively, for example, If i have a function read_next, calling it the first time would return the first 20 characters in a string, calling it the second time would return the next 20 characters of the file. Please note, I don’t want to read the whole file into an array then break it up.
Share
Basically, you want to use
InputStream#read(byte[])Then you basically want to call this method…
UPDATED
After some nice feedback, you could also apply the same idea to UFT-8 encoded file using a
ReaderAnd call the method as such…