class BinData::BitAligned::BitAlignedIO

def binary_string(str)

def binary_string(str)
  str.to_s.dup.force_encoding(Encoding::BINARY)
end

def initialize(io)

def initialize(io)
  @io = io
end

def readbytes(n)

def readbytes(n)
  n.times.inject(binary_string("")) do |bytes, _|
    bytes + @io.readbits(8, :big).chr
  end
end

def writebytes(str)

def writebytes(str)
  str.each_byte { |v| @io.writebits(v, 8, :big) }
end