# File lib/archive/zip/entry.rb, line 694
    def dump_central_file_record(io)
      bytes_written = 0

      # Assume that no trailing data descriptor will be necessary.
      need_trailing_data_descriptor = false
      begin
        io.pos
      rescue Errno::ESPIPE
        # A trailing data descriptor is required for non-seekable IO.
        need_trailing_data_descriptor = true
      end
      if encryption_codec.class == Codec::TraditionalEncryption then
        # HACK:
        # According to the ZIP specification, a trailing data descriptor should
        # only be required when writing to non-seekable IO , but InfoZIP
        # *always* does this when using traditional encryption even though it
        # will also write the data descriptor in the usual place if possible.
        # Failure to emulate InfoZIP in this behavior will prevent InfoZIP
        # compatibility with traditionally encrypted entries.
        need_trailing_data_descriptor = true
      end

      # Set the general purpose flags.
      general_purpose_flags  = compression_codec.general_purpose_flags
      general_purpose_flags |= encryption_codec.general_purpose_flags
      if need_trailing_data_descriptor then
        general_purpose_flags |= FLAG_DATA_DESCRIPTOR_FOLLOWS
      end

      # Select the minimum ZIP specification version needed to extract this
      # entry.
      version_needed_to_extract = compression_codec.version_needed_to_extract
      if encryption_codec.version_needed_to_extract > version_needed_to_extract then
        version_needed_to_extract = encryption_codec.version_needed_to_extract
      end

      # Write the data.
      bytes_written += io.write(CFH_SIGNATURE)
      bytes_written += io.write(
        [
          version_made_by,
          version_needed_to_extract,
          general_purpose_flags,
          compression_codec.compression_method,
          mtime.to_dos_time.to_i
        ].pack('vvvvV')
      )
      bytes_written += @data_descriptor.dump(io)
      extra_field_data = central_extra_field_data
      bytes_written += io.write(
        [
          zip_path.length,
          extra_field_data.length,
          comment.length,
          0,
          internal_file_attributes,
          external_file_attributes,
          @local_file_record_position
        ].pack('vvvvvVV')
      )
      bytes_written += io.write(zip_path)
      bytes_written += io.write(extra_field_data)
      bytes_written += io.write(comment)

      bytes_written
    end