gpt4 book ai didi

org.apache.poi.openxml4j.util.ZipFileZipEntrySource.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 07:33:31 30 4
gpt4 key购买 nike

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

ZipFileZipEntrySource.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Write out this workbook to an OutputStream.
 *
 * @param stream - the java OutputStream you wish to write to
 * @exception IOException if anything can't be written.
 */
@Override
public void write(OutputStream stream) throws IOException {
  flushSheets();
  //Save the template
  File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx");
  boolean deleted;
  try {
    try (FileOutputStream os = new FileOutputStream(tmplFile)) {
      _wb.write(os);
    }
    //Substitute the template entries with the generated sheet data files
    try (ZipSecureFile zf = new ZipSecureFile(tmplFile);
       ZipFileZipEntrySource source = new ZipFileZipEntrySource(zf)) {
      injectData(source, stream);
    }
  } finally {
    deleted = tmplFile.delete();
  }
  if(!deleted) {
    throw new IOException("Could not delete temporary file after processing: " + tmplFile);
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Constructor. Opens a Zip based Open XML document from a File.
 *
 * @param file
 *            The file to open or create.
 * @param access
 *            The package access mode.
 * @throws InvalidOperationException If the zip file cannot be opened.
 */
ZipPackage(File file, PackageAccess access) throws InvalidOperationException {
  super(access);
  ZipEntrySource ze;
  try {
    final ZipFile zipFile = ZipHelper.openZipFile(file); // NOSONAR
    ze = new ZipFileZipEntrySource(zipFile);
  } catch (IOException e) {
    // probably not happening with write access - not sure how to handle the default read-write access ...
    if (access == PackageAccess.WRITE) {
      throw new InvalidOperationException("Can't open the specified file: '" + file + "'", e);
    }
    if ("java.util.zip.ZipException: archive is not a ZIP archive".equals(e.getMessage())) {
      throw new NotOfficeXmlFileException("archive is not a ZIP archive", e);
    }
    LOG.log(POILogger.ERROR, "Error in zip file "+file+" - falling back to stream processing (i.e. ignoring zip central directory)");
    ze = openZipEntrySourceStream(file);
  }
  this.zipArchive = ze;
}

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

zipEntrySource = new ZipFileZipEntrySource(new ZipFile(stream.getFile()));
} catch (IOException e) {
  return tryStreamingDetection(stream);

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Constructor. Opens a Zip based Open XML document.
 *
 * @param path
 *            The path of the file to open or create.
 * @param access
 *            The package access mode.
 * @throws InvalidFormatException
 *             If the content type part parsing encounters an error.
 */
ZipPackage(String path, PackageAccess access) {
  super(access);
  ZipFile zipFile = ZipHelper.openZipFile(path);
  if (zipFile == null)
    throw new InvalidOperationException(
        "Can't open the specified file: '" + path + "'");
  this.zipArchive = new ZipFileZipEntrySource(zipFile);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Write out this workbook to an OutputStream.
 *
 * @param stream - the java OutputStream you wish to write to
 * @exception IOException if anything can't be written.
 */
@Override
public void write(OutputStream stream) throws IOException {
  flushSheets();
  //Save the template
  File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx");
  boolean deleted;
  try {
    try (FileOutputStream os = new FileOutputStream(tmplFile)) {
      _wb.write(os);
    }
    //Substitute the template entries with the generated sheet data files
    try (ZipSecureFile zf = new ZipSecureFile(tmplFile);
       ZipFileZipEntrySource source = new ZipFileZipEntrySource(zf)) {
      injectData(source, stream);
    }
  } finally {
    deleted = tmplFile.delete();
  }
  if(!deleted) {
    throw new IOException("Could not delete temporary file after processing: " + tmplFile);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Constructor. Opens a Zip based Open XML document from a File.
 *
 * @param file
 *            The file to open or create.
 * @param access
 *            The package access mode.
 * @throws InvalidOperationException If the zip file cannot be opened.
 */
ZipPackage(File file, PackageAccess access) throws InvalidOperationException {
  super(access);
  ZipEntrySource ze;
  try {
    final ZipFile zipFile = ZipHelper.openZipFile(file); // NOSONAR
    ze = new ZipFileZipEntrySource(zipFile);
  } catch (IOException e) {
    // probably not happening with write access - not sure how to handle the default read-write access ...
    if (access == PackageAccess.WRITE) {
      throw new InvalidOperationException("Can't open the specified file: '" + file + "'", e);
    }
    if ("java.util.zip.ZipException: archive is not a ZIP archive".equals(e.getMessage())) {
      throw new NotOfficeXmlFileException("archive is not a ZIP archive", e);
    }
    LOG.log(POILogger.ERROR, "Error in zip file "+file+" - falling back to stream processing (i.e. ignoring zip central directory)");
    ze = openZipEntrySourceStream(file);
  }
  this.zipArchive = ze;
}

代码示例来源:origin: org.apache.tika/tika-parsers

zipEntrySource = new ZipFileZipEntrySource(new ZipFile(stream.getFile()));
} catch (IOException e) {
  return null;

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