Class: Thrift::LookaheadReader
- Inherits:
-
Object
- Object
- Thrift::LookaheadReader
- Defined in:
- lib/thrift/protocol/json_protocol.rb
Instance Method Summary collapse
-
#initialize(trans) ⇒ LookaheadReader
constructor
A new instance of LookaheadReader.
- #peek ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(trans) ⇒ LookaheadReader
Returns a new instance of LookaheadReader.
24 25 26 27 28 |
# File 'lib/thrift/protocol/json_protocol.rb', line 24 def initialize(trans) @trans = trans @hasData = false @data = nil end |
Instance Method Details
#peek ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/thrift/protocol/json_protocol.rb', line 40 def peek if !@hasData @data = @trans.read(1) end @hasData = true return @data end |
#read ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/thrift/protocol/json_protocol.rb', line 30 def read if @hasData @hasData = false else @data = @trans.read(1) end return @data end |