示例#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);
        }