Fixes a compilation error in Reader when using encoded stream.

Added unit test for parsing EncodedStream to Document.