gpt4 book ai didi

eu.infomas.annotation.ZipFileIterator类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:21:42 25 4
gpt4 key购买 nike

本文整理了Java中eu.infomas.annotation.ZipFileIterator类的一些代码示例,展示了ZipFileIterator类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFileIterator类的具体详情如下:
包路径:eu.infomas.annotation.ZipFileIterator
类名称:ZipFileIterator

ZipFileIterator介绍

[英]ZipFileIterator is used to iterate over all entries in a given zip or jar file and returning the InputStream of these entries.

It is possible to specify an (optional) entry name filter.

The most efficient way of iterating is used, see benchmark in test classes.
[中]ZipFileIterator用于迭代给定zip或jar文件中的所有条目,并返回这些条目的InputStream。
可以指定(可选)条目名称筛选器。
使用最有效的迭代方式,请参见测试类中的基准测试。

代码示例

代码示例来源:origin: rmuller/infomas-asl

@SuppressWarnings("emptyblock")
public InputStream next() throws IOException {
  while (entries.hasMoreElements()) {
    current = entries.nextElement();
    if (accept(current)) {
      return zipFile.getInputStream(current);
    }
  }
  // no more entries in this ZipFile, so close ZipFile
  try {
    // zipFile is never null here
    zipFile.close();
  } catch (IOException ex) {
    // suppress IOException, otherwise close() is called twice
  }
  return null;
}

代码示例来源:origin: rmuller/infomas-asl

/**
 * Return the name of the Java ClassFile returned from the last call to {@link #next()}.
 * The name is either the path name of a file or the name of an ZIP/JAR file entry.
 */
public String getName() {
  // Both getPath() and getName() are very light weight method calls
  return zipIterator == null ?
    fileIterator.getFile().getPath() :
    zipIterator.getEntry().getName();
}

代码示例来源:origin: fivesmallq/web-data-extractor

@Override
public InputStream next() throws IOException {
  while (true) {
    if (zipIterator == null) {
      final File file = fileIterator.next();
      // not all specified Files exists!
      if (file == null || !file.isFile()) {
        return null;
      } else {
        final String name = file.getName();
        if (name.endsWith(".class")) {
          return new FileInputStream(file);
        } else if (fileIterator.isRootFile() &&
            (endsWithIgnoreCase(name, ".jar") || isZipFile(file))) {
          zipIterator = new ZipFileIterator(new ZipFile(file), pkgNameFilter);
        } // else just ignore
      }
    } else {
      final InputStream is = zipIterator.next();
      if (is == null) {
        zipIterator = null;
      } else {
        return is;
      }
    }
  }
}

代码示例来源:origin: rmuller/infomas-asl

@Override
public InputStream next() throws IOException {
  while (true) {
    if (zipIterator == null) {
      final File file = fileIterator.next();
      // not all specified Files exists!
      if (file == null || !file.isFile()) {
        return null;
      } else {
        final String name = file.getName();
        if (name.endsWith(".class")) {
          return new FileInputStream(file);
        } else if (fileIterator.isRootFile() &&
          (endsWithIgnoreCase(name, ".jar") || isZipFile(file))) {
          zipIterator = new ZipFileIterator(new ZipFile(file), pkgNameFilter);
        } // else just ignore
      }
    } else {
      final InputStream is = zipIterator.next();
      if (is == null) {
        zipIterator = null;
      } else {
        return is;
      }
    }
  }
}

代码示例来源:origin: fivesmallq/web-data-extractor

/**
 * Return the name of the Java ClassFile returned from the last call to {@link #next()}.
 * The name is either the path name of a file or the name of an ZIP/JAR file entry.
 */
public String getName() {
  // Both getPath() and getName() are very light weight method calls
  return zipIterator == null ?
      fileIterator.getFile().getPath() :
      zipIterator.getEntry().getName();
}

代码示例来源:origin: fivesmallq/web-data-extractor

@SuppressWarnings("emptyblock")
public InputStream next() throws IOException {
  while (entries.hasMoreElements()) {
    current = entries.nextElement();
    if (accept(current)) {
      return zipFile.getInputStream(current);
    }
  }
  // no more entries in this ZipFile, so close ZipFile
  try {
    // zipFile is never null here
    zipFile.close();
  } catch (IOException ex) {
    // suppress IOException, otherwise close() is called twice
  }
  return null;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com