예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TarWriter"/> class.
        /// </summary>
        /// <param name="target">Target stream to write to.</param>
        /// <param name="gzip">Use gzip compression.</param>
        public TarWriter(Stream target, bool gzip)
        {
            var s = baseStream = target;

            if (gzip)
            {
                s = new GZipOutputStream(s);
            }

            tarStream = new TarOutputStream(s);
        }
예제 #2
0
        /// <summary>
        /// Releases the unmanaged resources used and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        #region IDisposable Support
        protected virtual void Dispose(bool disposing)
        {
            if (tarStream != null)
            {
                if (disposing)
                {
                    tarStream.Dispose();
                }

                baseStream = null;
                tarStream  = null;
            }
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TarArchive"/> class.
 /// </summary>
 /// <param name="stream">The <see cref="TarOutputStream"/> to use for output.</param>
 protected TarArchive(TarOutputStream stream)
 {
     tarOut = stream ?? throw new ArgumentNullException(nameof(stream));
 }