Files

Class Index [+]

Quicksearch

Thrift::FramedTransport

Public Class Methods

new(transport, read=true, write=true) click to toggle source
    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 23
23:     def initialize(transport, read=true, write=true)
24:       @transport = transport
25:       @rbuf      = ''
26:       @wbuf      = ''
27:       @read      = read
28:       @write     = write
29:       @index      = 0
30:     end

Public Instance Methods

close() click to toggle source
    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 40
40:     def close
41:       @transport.close
42:     end
flush() click to toggle source

Writes the output buffer to the stream in the format of a 4-byte length followed by the actual data.

    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 65
65:     def flush
66:       return @transport.flush unless @write
67: 
68:       out = [@wbuf.length].pack('N')
69:       out << @wbuf
70:       @transport.write(out)
71:       @transport.flush
72:       @wbuf = ''
73:     end
open() click to toggle source
    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 36
36:     def open
37:       @transport.open
38:     end
open?() click to toggle source
    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 32
32:     def open?
33:       @transport.open?
34:     end
read(sz) click to toggle source
    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 44
44:     def read(sz)
45:       return @transport.read(sz) unless @read
46: 
47:       return '' if sz <= 0
48: 
49:       read_frame if @index >= @rbuf.length
50: 
51:       @index += sz
52:       @rbuf.slice(@index - sz, sz) || ''
53:     end
write(buf,sz=nil) click to toggle source
    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 55
55:     def write(buf,sz=nil)
56:       return @transport.write(buf) unless @write
57: 
58:       @wbuf << (sz ? buf[0...sz] : buf)
59:     end

Private Instance Methods

read_frame() click to toggle source
    # File /tmp/buildd/evernote-mode-0.10/ruby/lib/thrift/transport/framed_transport.rb, line 77
77:     def read_frame
78:       sz = @transport.read_all(4).unpack('N').first
79: 
80:       @index = 0
81:       @rbuf = @transport.read_all(sz)
82:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.