class Thrift::LookaheadReader

Public Class Methods

new(trans) click to toggle source
# File lib/thrift/protocol/json_protocol.rb, line 24
def initialize(trans)
  @trans = trans
  @hasData = false
  @data = nil
end

Public Instance Methods

peek() click to toggle source
# File lib/thrift/protocol/json_protocol.rb, line 40
def peek
  if !@hasData
    @data = @trans.read(1)
  end
  @hasData = true
  return @data
end
read() click to toggle source
# File lib/thrift/protocol/json_protocol.rb, line 30
def read
  if @hasData
    @hasData = false
  else
    @data = @trans.read(1)
  end

  return @data
end