Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 370 Bytes

README.md

File metadata and controls

17 lines (15 loc) · 370 Bytes

Golang bitstream reader/writer

reader, _ := os.Open("input")
r := &bits.Reader{R: reader}
u32, err = r.ReadBits(4)
u64, err = r.ReadBits64(4)
p := make([]byte, 4)
n, err = r.Read(p)
  
writer, _ := os.Create("output")
w := &bits.Writer{W: writer}
err = w.WriteBits(0xf, 4)
err = w.WriteBits64(0xf, 4)
n, err = w.Write([]byte{0x34,0x56})
err = w.FlushBits()