- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.closeArchiveEntry()
方法的一些代码示例,展示了ZipArchiveOutputStream.closeArchiveEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipArchiveOutputStream.closeArchiveEntry()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
类名称:ZipArchiveOutputStream
方法名:closeArchiveEntry
[英]Writes all necessary data for this entry.
[中]写入此条目的所有必要数据。
代码示例来源:origin: plutext/docx4j
public void saveContentTypes(ContentTypeManager ctm) throws Docx4JException {
try {
zos.putArchiveEntry(new ZipArchiveEntry("[Content_Types].xml"));
ctm.marshal(zos);
zos.closeArchiveEntry();
} catch (Exception e) {
throw new Docx4JException("Error marshalling Content_Types ", e);
}
}
代码示例来源:origin: plutext/docx4j
public void saveXmlPart(XmlPart part) throws Docx4JException {
String targetName = part.getPartName().getName().substring(1);
try {
// Add ZIP entry to output stream.
zos.putArchiveEntry(new ZipArchiveEntry(targetName));
Document doc = part.getDocument();
/*
* With Crimson, this gives:
*
Exception in thread "main" java.lang.AbstractMethodError: org.apache.crimson.tree.XmlDocument.getXmlStandalone()Z
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:373)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:127)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:94)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:662)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:708)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
at org.docx4j.model.datastorage.CustomXmlDataStorageImpl.writeDocument(CustomXmlDataStorageImpl.java:174)
*
*/
DOMSource source = new DOMSource(doc);
XmlUtils.getTransformerFactory().newTransformer().transform(source,
new StreamResult(zos) );
// Complete the entry
zos.closeArchiveEntry();
} catch (Exception e) {
throw new Docx4JException("Error marshalling XmlPart " + part.getPartName(), e);
}
}
代码示例来源:origin: plutext/docx4j
public void saveCustomXmlDataStoragePart(CustomXmlDataStoragePart part) throws Docx4JException {
String targetName = part.getPartName().getName().substring(1);
try {
// Add ZIP entry to output stream.
zos.putArchiveEntry(new ZipArchiveEntry(targetName));
part.getData().writeDocument( zos );
// Complete the entry
zos.closeArchiveEntry();
} catch (Exception e) {
throw new Docx4JException("Error marshalling CustomXmlDataStoragePart " + part.getPartName(), e);
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public boolean marshall(PackagePart part, OutputStream out)
throws OpenXML4JException {
if (!(out instanceof ZipArchiveOutputStream)) {
throw new IllegalArgumentException("ZipOutputStream expected!");
}
ZipArchiveOutputStream zos = (ZipArchiveOutputStream) out;
// Saving the part in the zip file
ZipArchiveEntry ctEntry = new ZipArchiveEntry(ZipHelper
.getZipItemNameFromOPCName(part.getPartName().getURI()
.toString()));
try {
// Save in ZIP
zos.putArchiveEntry(ctEntry); // Add entry in ZIP
try {
super.marshall(part, out); // Marshall the properties inside a XML
// Document
return StreamHelper.saveXmlInStream(xmlDoc, out);
} finally {
zos.closeArchiveEntry();
}
} catch (IOException e) {
throw new OpenXML4JException(e.getLocalizedMessage(), e);
}
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
return StreamHelper.saveXmlInStream(xmlOutDoc, zos);
} finally {
zos.closeArchiveEntry();
代码示例来源:origin: org.apache.poi/poi-ooxml
@SuppressWarnings("resource")
@Override
public boolean saveImpl(Document content, OutputStream out) {
final ZipArchiveOutputStream zos = (out instanceof ZipArchiveOutputStream)
? (ZipArchiveOutputStream) out : new ZipArchiveOutputStream(out);
ZipArchiveEntry partEntry = new ZipArchiveEntry(CONTENT_TYPES_PART_NAME);
try {
// Referenced in ZIP
zos.putArchiveEntry(partEntry);
try {
// Saving data in the ZIP file
return StreamHelper.saveXmlInStream(content, zos);
} finally {
zos.closeArchiveEntry();
}
} catch (IOException ioe) {
logger.log(POILogger.ERROR, "Cannot write: " + CONTENT_TYPES_PART_NAME
+ " in Zip !", ioe);
return false;
}
}
}
代码示例来源:origin: plutext/docx4j
zos.closeArchiveEntry();
代码示例来源:origin: plutext/docx4j
zos.closeArchiveEntry();
代码示例来源:origin: org.apache.poi/poi-ooxml
cos.close();
fos2.close();
zos.closeArchiveEntry();
代码示例来源:origin: org.apache.poi/poi-ooxml
IOUtils.copy(ins, zos);
} finally {
zos.closeArchiveEntry();
代码示例来源:origin: org.apache.poi/poi-ooxml
zos.closeArchiveEntry();
代码示例来源:origin: org.apache.commons/commons-compress
closeArchiveEntry();
代码示例来源:origin: apache/tika
private static void zipStoreBuffer(ZipArchiveOutputStream zip, String name, byte[] dataBuffer) throws IOException {
ZipEntry zipEntry = new ZipEntry(name != null ? name : UUID.randomUUID().toString());
zipEntry.setMethod(ZipOutputStream.STORED);
zipEntry.setSize(dataBuffer.length);
CRC32 crc32 = new CRC32();
crc32.update(dataBuffer);
zipEntry.setCrc(crc32.getValue());
try {
zip.putArchiveEntry(new ZipArchiveEntry(zipEntry));
} catch (ZipException ex) {
if (name != null) {
zipStoreBuffer(zip, "x-" + name, dataBuffer);
return;
}
}
zip.write(dataBuffer);
zip.closeArchiveEntry();
}
代码示例来源:origin: naver/ngrinder
IOUtils.closeQuietly(fis);
zos.closeArchiveEntry();
代码示例来源:origin: apache/tika
outputStream.closeArchiveEntry();
if (!successfullyCopied) {
break;
代码示例来源:origin: org.xwiki.platform/xwiki-platform-filter-stream-xar
public void closeEntry() throws FilterException
{
try {
this.zipStream.closeArchiveEntry();
} catch (IOException e) {
throw new FilterException("Failed to close zip archive entry", e);
}
}
代码示例来源:origin: USPTO/PatentPublicData
@Override
public void close() throws IOException {
if (outputZip != null){
outputZip.closeArchiveEntry();
outputZip.close();
}
outputZip = null;
}
代码示例来源:origin: stackoverflow.com
byte[] zip(byte[] data, String filename) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(bos);
ZipArchiveEntry entry = new ZipArchiveEntry(filename);
entry.setSize(data.length);
zos.putArchiveEntry(entry);
zos.write(data);
zos.closeArchiveEntry();
zos.close();
bos.close();
return bos.toByteArray();
}
代码示例来源:origin: org.docx4j/docx4j
public void saveContentTypes(ContentTypeManager ctm) throws Docx4JException {
try {
zos.putArchiveEntry(new ZipArchiveEntry("[Content_Types].xml"));
ctm.marshal(zos);
zos.closeArchiveEntry();
} catch (Exception e) {
throw new Docx4JException("Error marshalling Content_Types ", e);
}
}
代码示例来源:origin: org.docx4j/docx4j
public void saveCustomXmlDataStoragePart(CustomXmlDataStoragePart part) throws Docx4JException {
String targetName = part.getPartName().getName().substring(1);
try {
// Add ZIP entry to output stream.
zos.putArchiveEntry(new ZipArchiveEntry(targetName));
part.getData().writeDocument( zos );
// Complete the entry
zos.closeArchiveEntry();
} catch (Exception e) {
throw new Docx4JException("Error marshalling CustomXmlDataStoragePart " + part.getPartName(), e);
}
}
本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.closeArchiveEntry()方法的一些代
我是一名优秀的程序员,十分优秀!