I need to implement a Reader which will periodically need to peek ahead at some of the data while reading it. As I see it, there are two ways I could implement this:
1. Using a mark(), read(), and reset() paradigm
2. Using a PushbackReader in which I read the data, and then unread() it
I was wondering if people had some input (no pun indented) as to any significant pros or cons of the two paradigms. Obviously with the first I need an underlying reader that supports marking -- I would likely use a BufferedReader. With the second I need to know ahead of time the largest number of characters I need to peek at so I can create the PushbackReader with a large enough buffer. That's not a problem. Other than those differences, I am hard pressed to see any pros or cons either way. Just as some more information, the reader will need to peek at 2 or 3 characters sometimes, and blocks of up to 200 characters at other times.
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
subject: How to design/implement Reader with peek functionality