public Stream BeginWriteFile(IArchiveWriterEntry file)
            {
                FinishCurrentFile();

                if (file == null)
                    throw new ArgumentNullException("file");

                mCurrentFile = new FileEntry
                {
                    Name = file.Name,
                    CTime = EnsureUTC(file.CreationTime),
                    MTime = EnsureUTC(file.LastWriteTime),
                    ATime = EnsureUTC(file.LastAccessTime),
                };

                var attributes = file.Attributes;
                if (attributes.HasValue)
                    mCurrentFile.Flags = (uint)attributes.Value;

                if (mWriter == null && mBuffer == null)
                    mBuffer = new FragmentedMemoryStream();

                if (mEncryption != null)
                    mEncryptionEncoder = mEncryption.CreateEncoder();

                return mCurrentStream = new EncoderStream(this);
            }
        public static void WriteFile(this ArchiveWriter writer, IArchiveWriterEntry metadata, Stream content)
        {
            if (writer.CurrentEncoder == null)
                throw new InvalidOperationException("No current encoder configured.");

            using (var stream = writer.CurrentEncoder.BeginWriteFile(metadata))
                content.CopyTo(stream);
        }