Beispiel #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 )
            {
            #if NETCF_1_0
                throw new ArgumentOutOfRangeException("blockFactor");
            #else
                throw new ArgumentOutOfRangeException("blockFactor", "Factor cannot be negative");
            #endif
            }

            TarBuffer tarBuffer = new TarBuffer();
            tarBuffer.inputStream  = null;
            tarBuffer.outputStream = outputStream;
            tarBuffer.Initialize(blockFactor);

            return tarBuffer;
        }
Beispiel #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;
     this.buffer      = TarBuffer.CreateInputTarBuffer(inputStream, blockFactor);
 }