本文整理汇总了C#中ZipFile.getEntry方法的典型用法代码示例。如果您正苦于以下问题:C# ZipFile.getEntry方法的具体用法?C# ZipFile.getEntry怎么用?C# ZipFile.getEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZipFile
的用法示例。
在下文中一共展示了ZipFile.getEntry方法的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) + ")");
}
}
}
}
示例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);
}
}
}
}
}
示例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) {