Unpack internal Sphinx representation of ints, floats, strings, and arrays. needed by Sphinx search engine.
Returns true when response stream is out.
# File lib/sphinx/response.rb, line 23 def eof? @position >= @size end
Get float from stream.
# File lib/sphinx/response.rb, line 62 def get_float raise EOFError if @position + 4 > @size uval = @response[@position, 4].unpack('N*').first; @position += 4 return ([uval].pack('L')).unpack('f*').first end
Get int from stream.
# File lib/sphinx/response.rb, line 28 def get_int raise EOFError if @position + 4 > @size value = @response[@position, 4].unpack('N*').first @position += 4 return value end
Get 64-bit int from stream.
# File lib/sphinx/response.rb, line 36 def get_int64 raise EOFError if @position + 8 > @size hi, lo = @response[@position, 8].unpack('N*N*') @position += 8 return (hi << 32) + lo end
Get array of count ints from stream.
# File lib/sphinx/response.rb, line 44 def get_ints(count) length = 4 * count raise EOFError if @position + length > @size values = @response[@position, length].unpack('N*' * count) @position += length return values end
Get string from stream.
# File lib/sphinx/response.rb, line 53 def get_string length = get_int raise EOFError if @position + length > @size value = length > 0 ? @response[@position, length] : '' @position += length return value end
Generated with the Darkfish Rdoc Generator 2.