我有一個包含多個壓縮.gz文件的.tar文件。我沒有問題通過.tar文件創建目標目錄中的每個.gz文件。我想跳過將.gz全部寫在一起,然後從TarEntry/TarArchive中解壓縮它?並通過.Net原生GZipStream實時寫入其內容。甚至不知道這是可能的。SharpZipLib:從.tar文件內部解壓.gz文件?
這是我寫的每個g'zipped文件的當前代碼。不知道要修改哪些內容才能獲得我需要的位置。
using (FileStream _fsIn = new FileStream(@"F:\data\abc.tar", FileMode.Open, FileAccess.Read))
{
using (TarInputStream _tarIn = new TarInputStream(_fsIn))
{
TarEntry _tarEntry;
while ((_tarEntry = _tarIn.GetNextEntry()) != null)
{
string _archiveName = _tarEntry.Name;
using (FileStream _outStr = new FileStream(@"F:\data\" + _archiveName, FileMode.Create))
{
_tarIn.CopyEntryContents(_outStr);
}
}
}
}
讓我加... abc.tar中包含的gz文件大小爲1-5GB。 – BeerGuy 2011-04-21 17:20:37