bitstring icon indicating copy to clipboard operation
bitstring copied to clipboard

Add a write() method to BitStream?

Open bluetech opened this issue 10 years ago • 1 comments

Currently, there is .append() which always writes to end of the BitStream, and .overwrite() which writes from the current pos of the BitStream but not beyond the boundary.

It would be nice if there was a .write() method, which has similar semantics to write(2) on a seekable file, i.e. overwrites starting from current pos, but expands the BitStream of it reaches the end.

The use case is: I have some functions which I want to use both for constructing a new record (.append()) and mutating an existing record (.overwrite()).

Thanks for a nice library!

bluetech avatar Jun 10 '15 14:06 bluetech

I'm not a fan of adding new methods unless I really have to, but changing the semantics of overwrite so that it will write beyond the end seems reasonable.

That would technically be a breaking change, but probably small enough to get in.

(Sorry so long to comment on this - I wasn't receiving any notifications of new issues from Github).

scott-griffiths avatar Feb 06 '16 17:02 scott-griffiths