BitStream::read() - implementation and tests