Class: NBTFile::ListReaderState

Inherits:
Object
  • Object
show all
Includes:
ReadMethods, Tokens
Defined in:
lib/nbtfile.rb

Instance Method Summary collapse

Methods included from ReadMethods

#read_byte, #read_byte_array, #read_double, #read_float, #read_int, #read_integer, #read_list_header, #read_long, #read_raw, #read_short, #read_string, #read_type, #read_value

Methods included from CommonMethods

#sign_bit

Constructor Details

#initialize(cont, type, length) ⇒ ListReaderState

Returns a new instance of ListReaderState.



244
245
246
247
248
249
# File 'lib/nbtfile.rb', line 244

def initialize(cont, type, length)
  @cont = cont
  @length = length
  @offset = 0
  @type = type
end

Instance Method Details

#get_token(io) ⇒ Object



251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/nbtfile.rb', line 251

def get_token(io)
  if @offset < @length
    type = @type
  else
    type = TAG_End
  end

  index = @offset
  @offset += 1

  read_value(io, type, index, self, @cont)
end