# File lib/rubytorrent/bencoding.rb, line 96
  def self.parse_bencoding(c, s)
    ints = ""
    while ((x = s.getc.chr) != 'e')
      raise RubyTorrent::BEncodingError, "invalid bencoded integer #{x.inspect}" unless x =~ /\d|-/
      ints += x
    end
    raise RubyTorrent::BEncodingError, "invalid integer #{ints} (too long)" unless ints.length <= 20
    int = ints.to_i
    raise RubyTorrent::BEncodingError, %{can't parse bencoded integer "#{ints}"} if (int == 0) && (ints !~ /^0$/) #'
    int
  end