# File lib/archive/zip/entry.rb, line 1122
    def extract(options = {})
      # Ensure that unspecified options have default values.
      file_path           = options.has_key?(:file_path) ?
                            options[:file_path].to_s :
                            @zip_path
      restore_permissions = options.has_key?(:permissions) ?
                            options[:permissions] :
                            false
      restore_ownerships  = options.has_key?(:ownerships) ?
                            options[:ownerships] :
                            false
      restore_times       = options.has_key?(:times) ?
                            options[:times] :
                            false

      # Create the containing directory tree if necessary.
      parent_dir = ::File.dirname(file_path)
      FileUtils.mkdir_p(parent_dir) unless ::File.exist?(parent_dir)

      # Dump the file contents.
      ::File.open(file_path, 'wb') do |f|
        while buffer = file_data.read(4096) do
          f.write(buffer)
        end
      end

      # Verify that the extracted data is good.
      begin
        unless expected_data_descriptor.nil? then
          expected_data_descriptor.verify(file_data.data_descriptor)
        end
      rescue => e
        raise Zip::EntryError, "`#{zip_path}': #{e.message}"
      end

      # Restore the metadata.
      ::File.chmod(mode, file_path) if restore_permissions
      ::File.chown(uid, gid, file_path) if restore_ownerships
      ::File.utime(atime, mtime, file_path) if restore_times

      # Attempt to rewind the file data back to the beginning, but ignore
      # errors.
      begin
        file_data.rewind
      rescue
        # Ignore.
      end

      nil
    end