SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Decompress .gz from inside .tar file???

Last post 04-08-2011 8:46 AM by BeerGuy. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 04-08-2011 8:46 AM

    Decompress .gz from inside .tar file???

    I have a .tar file containing multiple compressed .gz files. I have no issue itterating through the .tar file creating each .gz file in a destination directory. I'd like to skip writting the .gz all together and just decompress it from the TarEntry/TarArchive? and write its contents on the fly via the .Net native GZipStream. Not even sure this is possible. Here is my current code that writes each contained .gz file.

     

                using (FileStream _fsIn = new FileStream(@"F:\data\xyz.tar", FileMode.Open, FileAccess.Read))

                {

                    TarInputStream _tarIn = new TarInputStream(_fsIn);

                    TarEntry _tarEntry;

                    while ((_tarEntry = _tarIn.GetNextEntry()) != null)

                    {

                        string _archiveName = _tarEntry.Name;

                        FileStream _outStr = new FileStream(@"F:\data\abc\" + _archiveName, FileMode.Create);

                        _tarIn.CopyEntryContents(outStr);

                        _outStr.Close();

                    }

                    _tarIn.Close();

                }

     

     

Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.