| 
| static PSIn  | New (const TStr &FNm) | 
|   | 
| static PSIn  | New (const TStr &FNm, bool &OpenedP) | 
|   | 
| static bool  | IsZipFNm (const TStr &FNm) | 
|   | Check whether the file extension of FNm is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2).  More...
  | 
|   | 
| static bool  | IsZipExt (const TStr &FNmExt) | 
|   | Check whether the file extension FNmExt is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2).  More...
  | 
|   | 
| static TStr  | GetCmd (const TStr &ZipFNm) | 
|   | Return a command-line string that is executed in order to decompress a file to standard output.  More...
  | 
|   | 
| static uint64  | GetFLen (const TStr &ZipFNm) | 
|   | Return the uncompressed size (in bytes) of the compressed file ZipFNm.  More...
  | 
|   | 
| static PSIn  | NewIfZip (const TStr &FNm) | 
|   | 
Compressed File Input Stream. The class reads from a compressed file without explicitly uncompressing it. This is eachieved by running external 7ZIP program which uncompresses to standard output, which is then piped to TZipFl. The class requires 7ZIP to be installed on the machine. Go to http://www.7-zip.org to install the software. 7z (7z.exe) is an executable and can decompress the following formats: .gz, .7z, .rar, .zip, .cab, .arj. bzip2. The class TZipIn expects that '7z' ('7z.exe') is in the working path. Make sure you can execute '7z e -y -bd -so <FILENAME>' For 7z to work properly you need both the 7z executable and the directory 'Codecs'. Use TZipIn::SevenZipPath to set the path to 7z executable.
NOTE: Current implementation of TZipIn supports only .zip format, other compression formats are not supported. 
Definition at line 15 of file zipfl.h.
 
      
        
          | TZipIn::TZipIn  | 
          ( | 
          const TStr &  | 
          FNm | ) | 
           | 
        
      
 
Definition at line 65 of file zipfl.cpp.
References Bf, BfC, BfL, CreateZipProcess(), TStr::CStr(), EAssertR, EFailR, TStr::Empty(), TFile::Exists(), FillBf(), FLen, TStr::Fmt(), GetCmd(), TStr::GetFExt(), GetFLen(), IsZipFNm(), MxBfL, ZipStdoutRd, and ZipStdoutWr.
   73     printf(
"*** Error: file %s, compression format %s not supported\n", FNm.
CStr(), FNm.
GetFExt().
CStr());
 
   78   if (FLen == 0) { 
return; } 
 
   81   SECURITY_ATTRIBUTES saAttr;
 
   82   saAttr.nLength = 
sizeof(SECURITY_ATTRIBUTES);
 
   83   saAttr.bInheritHandle = TRUE;
 
   84   saAttr.lpSecurityDescriptor = NULL;
 
   86   const int PipeBufferSz = 32*1024;
 
   89   SetHandleInformation(
ZipStdoutRd, HANDLE_FLAG_INHERIT, 0);
 
static TStr GetCmd(const TStr &ZipFNm)
Return a command-line string that is executed in order to decompress a file to standard output...
 
static bool Exists(const TStr &FNm)
 
static bool IsZipFNm(const TStr &FNm)
Check whether the file extension of FNm is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2). 
 
static TStr Fmt(const char *FmtStr,...)
 
#define EAssertR(Cond, MsgStr)
 
void CreateZipProcess(const TStr &Cmd, const TStr &ZipFNm)
 
 
 
 
Definition at line 48 of file zipfl.cpp.
References Bf, BfC, BfL, CurFPos, EAssert, EAssertR, FLen, TStr::Fmt(), TSBase::GetSNm(), MxBfL, and ZipStdoutRd.
Referenced by FindEol(), GetBf(), GetCh(), PeekCh(), and TZipIn().
   59   BfL = (int) BytesRead;
 
   61   EAssertR((
BfC!=0)||(
BfL!=0), 
"Error reading file '"+
GetSNm()+
"' (Set the TZipIn::SevenZipPath).");
 
static TStr Fmt(const char *FmtStr,...)
 
#define EAssertR(Cond, MsgStr)
 
virtual TStr GetSNm() const 
 
 
 
 
  
  
      
        
          | TStr TZipIn::GetCmd  | 
          ( | 
          const TStr &  | 
          ZipFNm | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Return a command-line string that is executed in order to decompress a file to standard output. 
Definition at line 223 of file zipfl.cpp.
References TStr::CStr(), EAssertR, THash< TKey, TDat, THashFunc >::Empty(), FExtToCmdH, FillFExtToCmdH(), TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetFExt(), TStr::GetLc(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by TZipIn().
static TStrStrH FExtToCmdH
 
static void FillFExtToCmdH()
 
const TDat & GetDat(const TKey &Key) const 
 
static TStr Fmt(const char *FmtStr,...)
 
#define EAssertR(Cond, MsgStr)
 
bool IsKey(const TKey &Key) const 
 
 
 
 
Return the uncompressed size (in bytes) of the compressed file ZipFNm. 
Definition at line 230 of file zipfl.cpp.
References Bf, BfC, BfL, TStr::CStr(), EAssert, EAssertR, TStr::Fmt(), IAssert, TVec< TVal, TSizeTy >::Len(), MxBfL, SaveToErrLog(), TStr::SplitOnWs(), WrNotify(), ZipStdoutRd, and ZipStdoutWr.
  234   SECURITY_ATTRIBUTES saAttr;
 
  235   saAttr.nLength = 
sizeof(SECURITY_ATTRIBUTES);
 
  236   saAttr.bInheritHandle = TRUE;
 
  237   saAttr.lpSecurityDescriptor = NULL;
 
  239   const int PipeBufferSz = 32*1024;
 
  240   EAssertR(CreatePipe(&ZipStdoutRd, &ZipStdoutWr, &saAttr, PipeBufferSz), 
"Stdout pipe creation failed");
 
  242   SetHandleInformation(ZipStdoutRd, HANDLE_FLAG_INHERIT, 0);
 
  245   PROCESS_INFORMATION piProcInfo;
 
  246   STARTUPINFO siStartInfo;
 
  247   ZeroMemory( &piProcInfo, 
sizeof(PROCESS_INFORMATION));
 
  248   ZeroMemory( &siStartInfo, 
sizeof(STARTUPINFO));
 
  249   siStartInfo.cb = 
sizeof(STARTUPINFO);
 
  251   siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
 
  253   const BOOL FuncRetn = CreateProcess(NULL, (LPSTR) CmdLine.
CStr(),
 
  254     NULL, NULL, TRUE, 0, NULL, NULL, &siStartInfo, &piProcInfo);
 
  255   EAssertR(FuncRetn!=0, 
TStr::Fmt(
"Can not execute '%s' (Set the TZipIn::SevenZipPath)", CmdLine.
CStr()).CStr());
 
  256   CloseHandle(piProcInfo.hProcess);
 
  257   CloseHandle(piProcInfo.hThread); }
 
  264   const int BfSz = 32*1024;
 
  265   char* 
Bf = 
new char [BfSz];
 
  270   EAssert(ReadFile(ZipStdoutRd, Bf, 
MxBfL, &BytesRead, NULL) != 0);
 
  272   size_t BytesRead = fread(Bf, 1, 
MxBfL, ZipStdoutRd);
 
  274   EAssert(pclose(ZipStdoutRd) != -1);
 
  277   BfC = 0; Bf[
BfL] = 0;
 
  279   TStr Str(Bf);  
delete [] 
Bf;
 
  280   TStrV StrV; Str.SplitOnWs(StrV);
 
  281   int n = StrV.
Len()-1;
 
  282   while (n > 0 && ! StrV[n].IsPrefix(
"-----")) { n--; }
 
  288   return StrV[n-7].GetInt64();
 
TSizeTy Len() const 
Returns the number of elements in the vector. 
 
void SaveToErrLog(const char *MsgCStr)
 
static TStr Fmt(const char *FmtStr,...)
 
#define EAssertR(Cond, MsgStr)
 
void WrNotify(const char *CaptionCStr, const char *NotifyCStr)
 
 
 
 
  
  
      
        
          | bool TZipIn::IsZipExt  | 
          ( | 
          const TStr &  | 
          FNmExt | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Check whether the file extension FNmExt is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2). 
Definition at line 199 of file zipfl.cpp.
References THash< TKey, TDat, THashFunc >::Empty(), FExtToCmdH, FillFExtToCmdH(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by IsZipFNm(), and TSsParser::TSsParser().
static TStrStrH FExtToCmdH
 
static void FillFExtToCmdH()
 
bool IsKey(const TKey &Key) const 
 
 
 
 
  
  
      
        
          | static bool TZipIn::IsZipFNm  | 
          ( | 
          const TStr &  | 
          FNm | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Check whether the file extension of FNm is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2). 
Definition at line 56 of file zipfl.h.
References TStr::GetFExt(), and IsZipExt().
Referenced by TSnap::LoadDyNet(), TSnap::LoadDyNetGraphV(), NewIfZip(), and TZipIn().
static bool IsZipExt(const TStr &FNmExt)
Check whether the file extension FNmExt is that of a compressed file (.gz, .7z, .rar, .zip, .cab, .arj. bzip2).