add bit stream writer

@davilla Can you comment on the intended usage here?