Class Thrift::BaseTransport
In: lib/thrift/transport/base_transport.rb
lib/thrift/transport/base_transport.rb
Parent: Object

Methods

<<   <<   close   close   flush   flush   open   open   open?   open?   read   read   read_all   read_all   read_byte   read_byte   read_into_buffer   read_into_buffer   write   write  

Public Instance methods

<<(buf)

Alias for write

<<(buf)

Alias for write

[Source]

    # File lib/thrift/transport/base_transport.rb, line 54
54:     def close; end

[Source]

    # File lib/thrift/transport/base_transport.rb, line 54
54:     def close; end

[Source]

     # File lib/thrift/transport/base_transport.rb, line 101
101:     def flush; end

[Source]

     # File lib/thrift/transport/base_transport.rb, line 101
101:     def flush; end

[Source]

    # File lib/thrift/transport/base_transport.rb, line 52
52:     def open; end

[Source]

    # File lib/thrift/transport/base_transport.rb, line 52
52:     def open; end

[Source]

    # File lib/thrift/transport/base_transport.rb, line 50
50:     def open?; end

[Source]

    # File lib/thrift/transport/base_transport.rb, line 50
50:     def open?; end

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.

[Source]

    # File lib/thrift/transport/base_transport.rb, line 61
61:     def read(sz)
62:       raise NotImplementedError
63:     end

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.

[Source]

    # File lib/thrift/transport/base_transport.rb, line 61
61:     def read(sz)
62:       raise NotImplementedError
63:     end

[Source]

    # File lib/thrift/transport/base_transport.rb, line 82
82:     def read_all(size)
83:       return Bytes.empty_byte_buffer if size <= 0
84:       buf = read(size)
85:       while (buf.length < size)
86:         chunk = read(size - buf.length)
87:         buf << chunk
88:       end
89:     
90:       buf
91:     end

[Source]

    # File lib/thrift/transport/base_transport.rb, line 82
82:     def read_all(size)
83:       return Bytes.empty_byte_buffer if size <= 0
84:       buf = read(size)
85:       while (buf.length < size)
86:         chunk = read(size - buf.length)
87:         buf << chunk
88:       end
89:     
90:       buf
91:     end

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

[Source]

    # File lib/thrift/transport/base_transport.rb, line 66
66:     def read_byte
67:       buf = read_all(1)
68:       return Bytes.get_string_byte(buf, 0)
69:     end

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

[Source]

    # File lib/thrift/transport/base_transport.rb, line 66
66:     def read_byte
67:       buf = read_all(1)
68:       return Bytes.get_string_byte(buf, 0)
69:     end

Reads size bytes and copies them into buffer.

[Source]

    # File lib/thrift/transport/base_transport.rb, line 72
72:     def read_into_buffer(buffer, size)
73:       tmp = read_all(size)
74:       i = 0
75:       tmp.each_byte do |byte|
76:         Bytes.set_string_byte(buffer, i, byte)
77:         i += 1
78:       end
79:       i
80:     end

Reads size bytes and copies them into buffer.

[Source]

    # File lib/thrift/transport/base_transport.rb, line 72
72:     def read_into_buffer(buffer, size)
73:       tmp = read_all(size)
74:       i = 0
75:       tmp.each_byte do |byte|
76:         Bytes.set_string_byte(buffer, i, byte)
77:         i += 1
78:       end
79:       i
80:     end

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.

[Source]

    # File lib/thrift/transport/base_transport.rb, line 98
98:     def write(buf); end

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.

[Source]

    # File lib/thrift/transport/base_transport.rb, line 98
98:     def write(buf); end

[Validate]