Sha256: 5efa87fc2c39cb9a021d8cc08949b444b9fd283a16b37630cfc7b83ffcd0c90f
Contents?: true
Size: 505 Bytes
Versions: 2
Compression:
Stored size: 505 Bytes
Contents
module NBTUtils class File def initialize(path = nil) @path = path end def read(path = @path) Zlib::GzipReader.open(path) do |f| @content = StringIO.new(f.read) end last_byte = @content.read(1).bytes.first klass = NBTUtils::Tag.tag_type_to_class(last_byte) @tag = klass.new(@content, true) end def write(path = @path, tag = @tag) Zlib::GzipWriter.open(path) do |gz| gz.write tag.to_nbt_string end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nbt_utils-0.0.3 | lib/nbt_utils/file.rb |
nbt_utils-0.0.2 | lib/nbt_utils/file.rb |