示例#1
0
        /// <summary>
        /// Construct TarBuffer for writing Tar output to streams.
        /// </summary>
        /// <param name="outputStream">Output stream to write to.</param>
        /// <param name="blockFactor">Blocking factor to apply</param>
        /// <returns>A new <see cref="TarBuffer"/> suitable for output.</returns>
        public static TarBuffer CreateOutputTarBuffer(Stream outputStream, int blockFactor)
        {
            if (outputStream == null)
            {
                throw new ArgumentNullException("outputStream");
            }

            if (blockFactor <= 0)
            {
                throw new ArgumentOutOfRangeException("blockFactor", "Factor cannot be negative");
            }

            var tarBuffer = new TarBuffer{inputStream = null, outputStream = outputStream};
            tarBuffer.Initialize(blockFactor);

            return tarBuffer;
        }
示例#2
0
 /// <summary>
 /// Construct a TarInputStream with user specified block factor
 /// </summary>
 /// <param name="inputStream">stream to source data from</param>
 /// <param name="blockFactor">block factor to apply to archive</param>
 public TarInputStream(Stream inputStream, int blockFactor)
 {
     this.inputStream = inputStream;
     _buffer          = TarBuffer.CreateInputTarBuffer(inputStream, blockFactor);
 }