    # File lib/rubygems/format.rb, line 64
        def self.from_io(io, gem_path="(io)", security_policy = nil)
          format = new gem_path

          Package.open io, 'r', security_policy do |pkg|
            format.spec = pkg.metadata
            format.file_entries = []

            pkg.each do |entry|
              size = entry.header.size
              mode = entry.header.mode

              format.file_entries << [{
                  "size" => size, "mode" => mode, "path" => entry.full_name,
                },
                entry.read
              ]
            end
          end

          format
        end