/// <summary>
        /// Set the file comment to be recorded when the current update is <see cref="CommitUpdate">commited</see>.
        /// </summary>
        /// <param name="comment">The comment to record.</param>
        /// <exception cref="ObjectDisposedException">HfsFile has been closed.</exception>
        public void SetComment(string comment)
        {
            if (isDisposed_)
            {
                throw new ObjectDisposedException("HfsFile");
            }

            CheckUpdating();

            newComment_ = new HfsString(comment);

            if (newComment_.RawLength > 0xffff)
            {
                newComment_ = null;
                throw new HfsException("Comment length exceeds maximum - 65535");
            }

            // We dont take account of the original and current comment appearing to be the same
            // as encoding may be different.
            commentEdited_ = true;
        }
        /// <summary>
        /// Begin updating this <see cref="HfsFile"/> archive.
        /// </summary>
        /// <param name="archiveStorage">The <see cref="IArchiveStorage">archive storage</see> for use during the update.</param>
        /// <param name="dataSource">The <see cref="IDynamicDataSource">data source</see> to utilise during updating.</param>
        /// <exception cref="ObjectDisposedException">HfsFile has been closed.</exception>
        /// <exception cref="ArgumentNullException">One of the arguments provided is null</exception>
        /// <exception cref="ObjectDisposedException">HfsFile has been closed.</exception>
        public void BeginUpdate(IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
        {
            if (archiveStorage == null)
            {
                throw new ArgumentNullException("archiveStorage");
            }

            if (dataSource == null)
            {
                throw new ArgumentNullException("dataSource");
            }

            if (isDisposed_)
            {
                throw new ObjectDisposedException("HfsFile");
            }

            if (IsEmbeddedArchive)
            {
                throw new HfsException("Cannot update embedded/SFX archives");
            }

            archiveStorage_ = archiveStorage;
            updateDataSource_ = dataSource;

            // NOTE: the baseStream_ may not currently support writing or seeking.

            updateIndex_ = new Hashtable();

            updates_ = new ArrayList(entries_.Length);
            foreach (HfsEntry entry in entries_)
            {
                int index = updates_.Add(new HfsUpdate(entry));
                updateIndex_.Add(entry.Name, index);
            }

            // We must sort by offset before using offset's calculated sizes
            updates_.Sort(new UpdateComparer());

            int idx = 0;
            foreach (HfsUpdate update in updates_)
            {
                //If last entry, there is no next entry offset to use
                if (idx == updates_.Count - 1)
                    break;

                update.OffsetBasedSize = ((HfsUpdate)updates_[idx + 1]).Entry.Offset - update.Entry.Offset;
                idx++;
            }
            updateCount_ = updates_.Count;

            contentsEdited_ = false;
            commentEdited_ = false;
            newComment_ = null;
        }