Class: Thrift::LookaheadReader
- Inherits:
-
Object
- Object
- Thrift::LookaheadReader
- Defined in:
- lib/thrift/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.
38 39 40 41 42 |
# File 'lib/thrift/json_protocol.rb', line 38 def initialize(trans) @trans = trans @hasData = false @data = nil end |
Instance Method Details
#peek ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/thrift/json_protocol.rb', line 54 def peek if !@hasData @data = @trans.read(1) end @hasData = true return @data end |
#read ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/thrift/json_protocol.rb', line 44 def read if @hasData @hasData = false else @data = @trans.read(1) end return @data end |