- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.openZipEntrySourceStream()
方法的一些代码示例,展示了ZipPackage.openZipEntrySourceStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipPackage.openZipEntrySourceStream()
方法的具体详情如下:
包路径:org.apache.poi.openxml4j.opc.ZipPackage
类名称:ZipPackage
方法名:openZipEntrySourceStream
暂无
代码示例来源:origin: org.apache.poi/poi-ooxml
private static ZipEntrySource openZipEntrySourceStream(File file) throws InvalidOperationException {
final FileInputStream fis;
// Acquire a resource that is needed to read the next level of openZipEntrySourceStream
try {
// open the file input stream
fis = new FileInputStream(file); // NOSONAR
} catch (final FileNotFoundException e) {
// If the source cannot be acquired, abort (no resources to free at this level)
throw new InvalidOperationException("Can't open the specified file input stream from file: '" + file + "'", e);
}
// If an error occurs while reading the next level of openZipEntrySourceStream, free the acquired resource
try {
// read from the file input stream
return openZipEntrySourceStream(fis);
} catch (final InvalidOperationException|UnsupportedFileFormatException e) {
// abort: close the zip input stream
IOUtils.closeQuietly(fis);
throw e;
} catch (final Exception e) {
// abort: close the file input stream
IOUtils.closeQuietly(fis);
throw new InvalidOperationException("Failed to read the file input stream from file: '" + file + "'", e);
}
}
代码示例来源: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: org.apache.poi/poi-ooxml
private static ZipEntrySource openZipEntrySourceStream(FileInputStream fis) throws InvalidOperationException {
final ZipArchiveThresholdInputStream zis;
// Acquire a resource that is needed to read the next level of openZipEntrySourceStream
try {
// open the zip input stream
zis = ZipHelper.openZipStream(fis); // NOSONAR
} catch (final IOException e) {
// If the source cannot be acquired, abort (no resources to free at this level)
throw new InvalidOperationException("Could not open the file input stream", e);
}
// If an error occurs while reading the next level of openZipEntrySourceStream, free the acquired resource
try {
// read from the zip input stream
return openZipEntrySourceStream(zis);
} catch (final InvalidOperationException|UnsupportedFileFormatException e) {
// abort: close the zip input stream
IOUtils.closeQuietly(zis);
throw e;
} catch (final Exception e) {
// abort: close the zip input stream
IOUtils.closeQuietly(zis);
throw new InvalidOperationException("Failed to read the zip entry source stream", e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
private static ZipEntrySource openZipEntrySourceStream(File file) throws InvalidOperationException {
final FileInputStream fis;
// Acquire a resource that is needed to read the next level of openZipEntrySourceStream
try {
// open the file input stream
fis = new FileInputStream(file); // NOSONAR
} catch (final FileNotFoundException e) {
// If the source cannot be acquired, abort (no resources to free at this level)
throw new InvalidOperationException("Can't open the specified file input stream from file: '" + file + "'", e);
}
// If an error occurs while reading the next level of openZipEntrySourceStream, free the acquired resource
try {
// read from the file input stream
return openZipEntrySourceStream(fis);
} catch (final InvalidOperationException|UnsupportedFileFormatException e) {
// abort: close the zip input stream
IOUtils.closeQuietly(fis);
throw e;
} catch (final Exception e) {
// abort: close the file input stream
IOUtils.closeQuietly(fis);
throw new InvalidOperationException("Failed to read the file input stream from file: '" + file + "'", e);
}
}
代码示例来源: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.servicemix.bundles/org.apache.servicemix.bundles.poi
private static ZipEntrySource openZipEntrySourceStream(FileInputStream fis) throws InvalidOperationException {
final ZipArchiveThresholdInputStream zis;
// Acquire a resource that is needed to read the next level of openZipEntrySourceStream
try {
// open the zip input stream
zis = ZipHelper.openZipStream(fis); // NOSONAR
} catch (final IOException e) {
// If the source cannot be acquired, abort (no resources to free at this level)
throw new InvalidOperationException("Could not open the file input stream", e);
}
// If an error occurs while reading the next level of openZipEntrySourceStream, free the acquired resource
try {
// read from the zip input stream
return openZipEntrySourceStream(zis);
} catch (final InvalidOperationException|UnsupportedFileFormatException e) {
// abort: close the zip input stream
IOUtils.closeQuietly(zis);
throw e;
} catch (final Exception e) {
// abort: close the zip input stream
IOUtils.closeQuietly(zis);
throw new InvalidOperationException("Failed to read the zip entry source stream", e);
}
}
我在 MSDN 上看到了关于 ZipPackage class 的文档. 上面的例子不是很有用,谁能提供一个关于这个类的例子? 最佳答案 举个例子,注意: - ZipPackage 似乎不压缩 - 生
我对这两个类感到困惑,它们似乎都用于创建或提取 zip 文件?谁能解释一下区别? 最佳答案 ZipPackage 类 - 实现抽象 Package 基类的派生子类——ZipPackage 类使用 ZI
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.getPackageProperties()方法的一些代码示例,展示了ZipPackage.getP
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.throwExceptionIfReadOnly()方法的一些代码示例,展示了ZipPackage.
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.save()方法的一些代码示例,展示了ZipPackage.save()的具体用法。这些代码示例主要
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.openZipEntrySourceStream()方法的一些代码示例,展示了ZipPackage.
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.getPartsByRelationshipType()方法的一些代码示例,展示了ZipPackag
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.addPackagePart()方法的一些代码示例,展示了ZipPackage.addPackage
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.()方法的一些代码示例,展示了ZipPackage.()的具体用法。这些代码示例主要来源于Githu
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.getParts()方法的一些代码示例,展示了ZipPackage.getParts()的具体用法。
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.getRelationshipsByType()方法的一些代码示例,展示了ZipPackage.ge
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.flush()方法的一些代码示例,展示了ZipPackage.flush()的具体用法。这些代码示例
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.getZipArchive()方法的一些代码示例,展示了ZipPackage.getZipArchi
本文整理了Java中org.apache.poi.openxml4j.opc.ZipPackage.getRelationships()方法的一些代码示例,展示了ZipPackage.getRelat
我正在尝试使用 NPOI 在 C# 中读取 excel 文件。下面是我用来初始化变量的代码片段。但是在初始化工作簿时,下面是我遇到的异常。 public class Excelhandler {
我已经使用 apache poi 完成了 Excel 工作表的读取和写入。但是如果我尝试使用相同的 apache poi 下载 ms-word,则会抛出以下错误。java.lang.IllegalAc
我是一名优秀的程序员,十分优秀!