Class: NBTFile::Private::Tokenizer

Inherits:
Object
  • Object
show all
Defined in:
lib/nbtfile.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ Tokenizer

Returns a new instance of Tokenizer.



302
303
304
305
# File 'lib/nbtfile.rb', line 302

def initialize(io)
  @gz = Zlib::GzipReader.new(io)
  @state = TopTokenizerState.new()
end

Instance Method Details

#each_tokenObject



307
308
309
310
311
# File 'lib/nbtfile.rb', line 307

def each_token
  while token = get_token()
    yield token
  end
end

#get_tokenObject



313
314
315
316
# File 'lib/nbtfile.rb', line 313

def get_token
  @state, token = @state.get_token(@gz)
  token
end