Parent

Thrift::BaseTransport

Public Instance Methods

<<(buf) click to toggle source
Alias for: write
close() click to toggle source
# File lib/thrift/transport/base_transport.rb, line 53
def close; end
flush() click to toggle source
# File lib/thrift/transport/base_transport.rb, line 100
def flush; end
open() click to toggle source
# File lib/thrift/transport/base_transport.rb, line 51
def open; end
open?() click to toggle source
# File lib/thrift/transport/base_transport.rb, line 49
def open?; end
read(sz) click to toggle source

Reads a number of bytes from the transports. In Ruby 1.9+, the String returned will have a BINARY (aka ASCII8BIT) encoding.

sz - The number of bytes to read from the transport.

Returns a String acting as a byte buffer.

# File lib/thrift/transport/base_transport.rb, line 60
def read(sz)
  raise NotImplementedError
end
read_all(size) click to toggle source
# File lib/thrift/transport/base_transport.rb, line 81
def read_all(size)
  return Bytes.empty_byte_buffer if size <= 0
  buf = read(size)
  while (buf.length < size)
    chunk = read(size - buf.length)
    buf << chunk
  end

  buf
end
read_byte() click to toggle source

Returns an unsigned byte as a Fixnum in the range (0..255).

# File lib/thrift/transport/base_transport.rb, line 65
def read_byte
  buf = read_all(1)
  return Bytes.get_string_byte(buf, 0)
end
read_into_buffer(buffer, size) click to toggle source

Reads size bytes and copies them into buffer.

# File lib/thrift/transport/base_transport.rb, line 71
def read_into_buffer(buffer, size)
  tmp = read_all(size)
  i = 0
  tmp.each_byte do |byte|
    Bytes.set_string_byte(buffer, i, byte)
    i += 1
  end
  i
end
write(buf) click to toggle source

Writes the byte buffer to the transport. In Ruby 1.9+, the buffer will be forced into BINARY encoding.

buf - A String acting as a byte buffer.

Returns nothing.

# File lib/thrift/transport/base_transport.rb, line 97
def write(buf); end
Also aliased as: <<

[Validate]

Generated with the Darkfish Rdoc Generator 2.