示例#1
0
        /// <summary>
        /// The InputStream based constructors create a TarArchive for the
        /// purposes of extracting or listing a tar archive. Thus, use
        /// these constructors when you wish to extract files from or list
        /// the contents of an existing tar archive.
        /// </summary>
        /// <param name="inputStream">The stream to retrieve archive data from.</param>
        /// <returns>Returns a new <see cref="TarArchive"/> suitable for reading from.</returns>
        public static TarArchive CreateInputTarArchive(Stream inputStream)
        {
            if (inputStream == null)
            {
                throw new ArgumentNullException("inputStream");
            }

            TarInputStream tarStream = inputStream as TarInputStream;

            TarArchive result;

            if (tarStream != null)
            {
                result = new TarArchive(tarStream);
            }
            else
            {
                result = CreateInputTarArchive(inputStream, TarBuffer.DefaultBlockFactor);
            }
            return(result);
        }
示例#2
0
		/// <summary>
		/// Initalise a TarArchive for input.
		/// </summary>
		/// <param name="stream">The <see cref="TarInputStream"/> to use for input.</param>
		protected TarArchive(TarInputStream stream)
		{
			if ( stream == null ) {
				throw new ArgumentNullException("stream");
			}
			
			tarIn = stream;
		}