ResettableInputStream implementation for heuristic reading.

Fix: failing MongoDb test removed (it is still in the branch where it belongs)