Yarhl
Yarhl copied to clipboard
Implement BitReader and BitWriter
Some binary formats requires to read / write fields bit by bit. We need to provide a solution for bit-level reading and writing.
I have considered implementing new methods in BinaryWriter
and BinaryReader
but it would make the implementation more complex since every other type like integer or string may need to mix bytes to be read. We should keep implementation different like BinaryReader
and TextReader
.
It should be able to read an write the following types:
- Single bit in boolean
-
BitArray
- Array of bytes
- Integer of variable bit size