org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextEntry()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(123)

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

ZipArchiveInputStream.getNextEntry介绍

暂无

代码示例

代码示例来源:origin: apache/nifi

try (final ZipArchiveInputStream zipIn = new ZipArchiveInputStream(new BufferedInputStream(in))) {
  ArchiveEntry zipEntry;
  while ((zipEntry = zipIn.getNextEntry()) != null) {
    if (zipEntry.isDirectory() || !fileMatches(zipEntry)) {
      continue;

代码示例来源:origin: plutext/docx4j

public ZipPartStore(InputStream is) throws Docx4JException {
  initMaxBytes();
  
  partByteArrays = new HashMap<String, ByteArray>();
  try {
    ZipArchiveInputStream zis = new ZipArchiveInputStream(is);
    ArchiveEntry entry = null;
    while ((entry = zis.getNextEntry()) != null) {
      // How to read the data descriptor for length? ie before reading?
      byte[] bytes =  getBytesFromInputStream( zis );
      //log.debug("Extracting " + entry.getName());
      policePartSize(null, bytes.length, entry.getName()); 
      partByteArrays.put(entry.getName(), new ByteArray(bytes) );
    }
    zis.close();
  } catch (PartTooLargeException e) {
    throw e;
  } catch (Exception e) {
    throw new Docx4JException("Error processing zip file (is it a zip file?)", e);
  }
}

代码示例来源:origin: dangdangdotcom/config-toolkit

@PostMapping("/import/{version:.+}")
public ModelAndView importData(@PathVariable String version, MultipartFile file){
  final String fileName = file.getOriginalFilename();
  LOGGER.info("Upload file : {}", fileName);
  try (InputStream in = file.getInputStream()) {
    if (fileName.endsWith(PROPERTIES)) {
      saveGroup(version, fileName, in);
    } else if (fileName.endsWith(ZIP)) {
      try (ZipArchiveInputStream input = new ZipArchiveInputStream(in)) {
        ArchiveEntry nextEntry = null;
        while ((nextEntry = input.getNextEntry()) != null) {
          String entryName = nextEntry.getName();
          saveGroup(version, entryName, input);
        }
      }
    }
  } catch (IOException e) {
    LOGGER.error(e.getMessage(), e);
  }
  return new ModelAndView("redirect:/version/" + version);
}

代码示例来源:origin: apache/stanbol

public LineIterator getEntries() throws IOException {
  if(name.endsWith(".zip")){
    ZipArchiveInputStream zipIn = new ZipArchiveInputStream(is);
    zipIn.getNextEntry();
    return IOUtils.lineIterator(zipIn, "UTF-8");
  } else {
    return IOUtils.lineIterator(is, "UTF-8");
  }
}

代码示例来源:origin: com.github.duanxinyuan/library-util-common

ZipArchiveInputStream zipArchiveInputStream = new ZipArchiveInputStream(is)) {
ArchiveEntry archiveEntry;
while ((archiveEntry = zipArchiveInputStream.getNextEntry()) != null) {

代码示例来源:origin: stackoverflow.com

zis = new ZipArchiveInputStream(fis, "Cp1252", true); // this supports non-USACII names
ArchiveEntry entry;
while ((entry = zis.getNextEntry()) != null) {
  File file = new File(outputFolder, entry.getName());
  if (entry.isDirectory()) {

代码示例来源:origin: org.apache.nifi/nifi-standard-processors

try (final ZipArchiveInputStream zipIn = new ZipArchiveInputStream(new BufferedInputStream(in))) {
  ArchiveEntry zipEntry;
  while ((zipEntry = zipIn.getNextEntry()) != null) {
    if (zipEntry.isDirectory() || !fileMatches(zipEntry)) {
      continue;

代码示例来源:origin: sismics/reader

ArchiveEntry archiveEntry = archiveInputStream.getNextEntry();
while (archiveEntry != null) {
  File outputFile = null;
  archiveEntry = archiveInputStream.getNextEntry();

代码示例来源:origin: org.docx4j/docx4j

public ZipPartStore(InputStream is) throws Docx4JException {
  initMaxBytes();
  
  partByteArrays = new HashMap<String, ByteArray>();
  try {
    ZipArchiveInputStream zis = new ZipArchiveInputStream(is);
    ArchiveEntry entry = null;
    while ((entry = zis.getNextEntry()) != null) {
      // How to read the data descriptor for length? ie before reading?
      byte[] bytes =  getBytesFromInputStream( zis );
      //log.debug("Extracting " + entry.getName());
      policePartSize(null, bytes.length, entry.getName()); 
      partByteArrays.put(entry.getName(), new ByteArray(bytes) );
    }
    zis.close();
  } catch (PartTooLargeException e) {
    throw e;
  } catch (Exception e) {
    throw new Docx4JException("Error processing zip file (is it a zip file?)", e);
  }
}

代码示例来源:origin: sismics/reader

ArchiveEntry archiveEntry = archiveInputStream.getNextEntry();
while (archiveEntry != null) {
  File outputFile = null;
  archiveEntry = archiveInputStream.getNextEntry();

代码示例来源:origin: ZuInnoTe/hadoopoffice

ZipArchiveOutputStream zos = new ZipArchiveOutputStream(fos);
ZipArchiveEntry ze;
while ((ze = (ZipArchiveEntry) zis.getNextEntry()) !=null) {

相关文章