Well, that's about 80% functionality of ByteArrayInputStream. Granted, `mark` is also a very useful thing (maybe even more useful. I'm counting LOC for the 80% figure).

Yes, it can be done without, and quite simple in fact, but I decided to opt for ByteArrayInputStream because otherwise you would have something like this `for (i = 0; i < input.length(); ++i)` where you don't declare the variable in loop (like `for (int i = 0, ...)` ).

Usually, when I see code like that, I stare at the code a bit harder. That usually means the coder is doing something very "clever", or I'm reading code from C89 (both are bad - in my book). Once again I'm opt for readability / psychology reason.