class BinData::IO

def readbytes(n)

If the data read is too short an IOError is raised.

If the data read is nil an EOFError is raised.

Reads exactly +n+ bytes from +io+.
def readbytes(n)
  reset_read_bits
  str = @raw_io.read(n)
  raise EOFError, "End of file reached" if str.nil?
  raise IOError, "data truncated" if str.size < n
  str
end