Class: NBTFile::Private::ListTokenizerState

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) ⇒ ListTokenizerState

Returns a new instance of ListTokenizerState.



274
275
276
277
278
279
# File 'lib/nbtfile.rb', line 274

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

Instance Method Details

#get_token(io) ⇒ Object



281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/nbtfile.rb', line 281

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