BaseTransport
# File lib/thrift/transport/memory_buffer_transport.rb, line 54 def available @buf.length - @index end
# File lib/thrift/transport/memory_buffer_transport.rb, line 41 def close end
# File lib/thrift/transport/memory_buffer_transport.rb, line 105 def flush end
# File lib/thrift/transport/memory_buffer_transport.rb, line 108 def inspect_buffer out = [] for idx in 0...(@buf.size) # if idx != 0 # out << " " # end if idx == @index out << ">" end out << @buf[idx].ord.to_s(16) end out.join(" ") end
# File lib/thrift/transport/memory_buffer_transport.rb, line 38 def open end
# File lib/thrift/transport/memory_buffer_transport.rb, line 34 def open? return true end
# File lib/thrift/transport/memory_buffer_transport.rb, line 44 def peek @index < @buf.size end
# File lib/thrift/transport/memory_buffer_transport.rb, line 58 def read(len) data = @buf.slice(@index, len) @index += len @index = @buf.size if @index > @buf.size if @index >= GARBAGE_BUFFER_SIZE @buf = @buf.slice(@index..-1) @index = 0 end if data.size < len raise EOFError, "Not enough bytes remain in buffer" end data end
# File lib/thrift/transport/memory_buffer_transport.rb, line 72 def read_byte raise EOFError.new("Not enough bytes remain in buffer") if @index >= @buf.size val = Bytes.get_string_byte(@buf, @index) @index += 1 if @index >= GARBAGE_BUFFER_SIZE @buf = @buf.slice(@index..-1) @index = 0 end val end
# File lib/thrift/transport/memory_buffer_transport.rb, line 83 def read_into_buffer(buffer, size) i = 0 while i < size raise EOFError.new("Not enough bytes remain in buffer") if @index >= @buf.size # The read buffer has some data now, so copy bytes over to the output buffer. byte = Bytes.get_string_byte(@buf, @index) Bytes.set_string_byte(buffer, i, byte) @index += 1 i += 1 end if @index >= GARBAGE_BUFFER_SIZE @buf = @buf.slice(@index..-1) @index = 0 end i end
Generated with the Darkfish Rdoc Generator 2.