class Thrift::BaseTransport

Public Instance Methods

<<(buf)
Alias for: write
close() click to toggle source
   # File lib/thrift/transport/base_transport.rb
54 def close; end
flush() click to toggle source
    # File lib/thrift/transport/base_transport.rb
103 def flush; end
open() click to toggle source
   # File lib/thrift/transport/base_transport.rb
52 def open; end
open?() click to toggle source
   # File lib/thrift/transport/base_transport.rb
50 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
61 def read(sz)
62   raise NotImplementedError
63 end
read_all(size) click to toggle source
   # File lib/thrift/transport/base_transport.rb
84 def read_all(size)
85   return Bytes.empty_byte_buffer if size <= 0
86   buf = read(size)
87   while (buf.length < size)
88     chunk = read(size - buf.length)
89     buf << chunk
90   end
91 
92   buf
93 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
68 def read_byte
69   buf = read_all(1)
70   return Bytes.get_string_byte(buf, 0)
71 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
74 def read_into_buffer(buffer, size)
75   tmp = read_all(size)
76   i = 0
77   tmp.each_byte do |byte|
78     Bytes.set_string_byte(buffer, i, byte)
79     i += 1
80   end
81   i
82 end
set_context(ctx) click to toggle source
   # File lib/thrift/transport/base_transport.rb
65 def set_context(ctx); 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
100 def write(buf); end
Also aliased as: <<