Fleshed out and pass unit tests.
Changed so I can reset the reference (so can be used by BitStream when TakeBuffer is called.
Now use BitStreamReadOnly as base class.