def from_io(io)
@io = io
version_maj, version_min, flags = @io.read(3).unpack("CCB4")
unsync, ext_header, experimental, footer = (0..3).collect { |i| flags[i].chr == '1' }
raise("can't find version_maj ('#{version_maj}')") unless [2, 3, 4].include?(version_maj)
@version_maj, @version_min = version_maj, version_min
@valid = true
tag2_len = @io.get_syncsafe
case @version_maj
when 2
read_id3v2_2_frames(tag2_len)
when 3,4
@io.seek(@io.get_syncsafe - 4, IO::SEEK_CUR) if ext_header
read_id3v2_3_frames(tag2_len)
end
@io_position = @io.pos
@hash_orig = @hash.dup
@io = nil
end