I'm trying to write a function that grabs a 4 character sequences of a file, sends that to another function, then continue to do the same thing from where the BufferedReader left off until the end of the file but can't seem to figure out how to make it work. Here is what I have so far:
Any help as to what I'm doing wrong is much appreciated.
You have a few problems. First of all, you don't need mark and reset. They are used to reread the same parts of a file.
Secondly, after you read your first sequence, the program will stop reading, because count is always 4. You don't reset it.
Thirdly, what happens when the file has less than 4 characters left at some point, but more than one? It will cast -1 to a character and append it to str. This will result in the last unicode character in existence.
Lastly, you might want to consider using a StringBuilder instead of a String. With a large file, the overhead of appending single characters to the end of a String may be very big.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com