class PDF::Reader::Buffer

def read_until(bytes)

bytes - the bytes to search for.

Reads from the buffer until the specified token is found, or the end of the buffer
###############################################################################
def read_until(bytes)
  out = ""
  size = bytes.size
   
  loop do
    out << @io.read(1)
    if out[-1 * size,size].eql?(bytes)
      out = out[0, out.size - size]
      seek(pos - size)
      break
    end
  end
  out
end