Class: Thrift::IOStreamTransport

Inherits:
BaseTransport show all
Defined in:
lib/thrift/transport/io_stream_transport.rb

Instance Method Summary collapse

Methods inherited from BaseTransport

#flush, #open, #read_all

Constructor Details

#initialize(input, output) ⇒ IOStreamTransport

Returns a new instance of IOStreamTransport.



28
29
30
31
# File 'lib/thrift/transport/io_stream_transport.rb', line 28

def initialize(input, output)
  @input = input
  @output = output
end

Instance Method Details

#closeObject



36
# File 'lib/thrift/transport/io_stream_transport.rb', line 36

def close; @input.close; @output.close end

#open?Boolean

Returns:

  • (Boolean)


33
# File 'lib/thrift/transport/io_stream_transport.rb', line 33

def open?; not @input.closed? or not @output.closed? end

#read(sz) ⇒ Object



34
# File 'lib/thrift/transport/io_stream_transport.rb', line 34

def read(sz); @input.read(sz) end

#to_ioObject

we’re assuming this is used in a IO.select for reading



37
# File 'lib/thrift/transport/io_stream_transport.rb', line 37

def to_io; @input end

#write(buf) ⇒ Object



35
# File 'lib/thrift/transport/io_stream_transport.rb', line 35

def write(buf); @output.write(buf) end