当前位置: 首页>>代码示例>>C#>>正文


C# ZipFile.getInputStream方法代码示例

本文整理汇总了C#中ZipFile.getInputStream方法的典型用法代码示例。如果您正苦于以下问题:C# ZipFile.getInputStream方法的具体用法?C# ZipFile.getInputStream怎么用?C# ZipFile.getInputStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZipFile的用法示例。


在下文中一共展示了ZipFile.getInputStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: test

        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void test() throws Exception
        public virtual void test()
        {
            for (int i = 0; i < tests.Length; i += 3)
            {
              File f = new File(DICTIONARY_HOME, tests[i]);
              Debug.Assert(f.exists());

              using (ZipFile zip = new ZipFile(f, StandardCharsets.UTF_8))
              {
            ZipEntry dicEntry = zip.getEntry(tests[i + 1]);
            Debug.Assert(dicEntry != null);
            ZipEntry affEntry = zip.getEntry(tests[i + 2]);
            Debug.Assert(affEntry != null);

            using (System.IO.Stream dictionary = zip.getInputStream(dicEntry), System.IO.Stream affix = zip.getInputStream(affEntry))
            {
              Dictionary dic = new Dictionary(affix, dictionary);
              Console.WriteLine(tests[i] + "\t" + RamUsageEstimator.humanSizeOf(dic) + "\t(" + "words=" + RamUsageEstimator.humanSizeOf(dic.words) + ", " + "flags=" + RamUsageEstimator.humanSizeOf(dic.flagLookup) + ", " + "strips=" + RamUsageEstimator.humanSizeOf(dic.stripData) + ", " + "conditions=" + RamUsageEstimator.humanSizeOf(dic.patterns) + ", " + "affixData=" + RamUsageEstimator.humanSizeOf(dic.affixData) + ", " + "prefixes=" + RamUsageEstimator.humanSizeOf(dic.prefixes) + ", " + "suffixes=" + RamUsageEstimator.humanSizeOf(dic.suffixes) + ")");
            }
              }
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:24,代码来源:TestAllDictionaries.cs

示例2: testOneDictionary

        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void testOneDictionary() throws Exception
        public virtual void testOneDictionary()
        {
            string toTest = "hu_HU.zip";
            for (int i = 0; i < tests.Length; i++)
            {
              if (tests[i].Equals(toTest))
              {
            File f = new File(DICTIONARY_HOME, tests[i]);
            Debug.Assert(f.exists());

            using (ZipFile zip = new ZipFile(f, StandardCharsets.UTF_8))
            {
              ZipEntry dicEntry = zip.getEntry(tests[i + 1]);
              Debug.Assert(dicEntry != null);
              ZipEntry affEntry = zip.getEntry(tests[i + 2]);
              Debug.Assert(affEntry != null);

              using (System.IO.Stream dictionary = zip.getInputStream(dicEntry), System.IO.Stream affix = zip.getInputStream(affEntry))
              {
                  new Dictionary(affix, dictionary);
              }
            }
              }
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:27,代码来源:TestAllDictionaries.cs

示例3: loadModelFromZip

 public static LexicalizedParser loadModelFromZip(String zipFilename,
                                                  String modelName) {
   LexicalizedParser parser = null;
   try {
     File file = new File(zipFilename);
     if (file.exists()) {
       ZipFile zin = new ZipFile(file);
       ZipEntry zentry = zin.getEntry(modelName);
       if (zentry != null) {
         InputStream in = zin.getInputStream(zentry);
         // gunzip it if necessary
         if (modelName.endsWith(".gz")) {
           in = new GZIPInputStream(in);
         }
         ObjectInputStream ois = new ObjectInputStream(in);
         parser = loadModel(ois);
         ois.close();
         in.close();
       }
       zin.close();
     } else {
       throw new FileNotFoundException("Could not find " + modelName +
                                       " inside " + zipFilename);
     }
   } catch (IOException e) {
开发者ID:gblosser,项目名称:OpenNlp,代码行数:25,代码来源:LexicalizedParser.cs


注:本文中的ZipFile.getInputStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。