本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.<init>()
方法的一些代码示例,展示了ZipArchiveOutputStream.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipArchiveOutputStream.<init>()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
类名称:ZipArchiveOutputStream
方法名:<init>
[英]Creates a new ZIP OutputStream writing to a File. Will use random access if possible.
[中]创建写入文件的新ZIP输出流。如果可能,将使用随机访问。
代码示例来源:origin: plutext/docx4j
/**
* @param zipOutputStream the zipOutputStream to set
*/
public void setOutputStream(OutputStream os) {
this.zos = new ZipArchiveOutputStream(os);
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void __construct(OutputStream outputStream) {
__wrappedObject = new ZipArchiveOutputStream(outputStream);
}
代码示例来源:origin: jphp-group/jphp
@Override
protected PArchiveOutput createOutput(Environment env) {
return new PZipArchiveOutput(env, new ZipArchiveOutputStream(Stream.getOutputStream(env, getSource())));
}
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Creates an archive {@code target} using the format {@code
* format} by recursively including all files and directories in
* {@code directory}.
*
* @param format the archive format. This uses the same format as
* accepted by {@link ArchiveStreamFactory}.
* @param target the channel to write the new archive to.
* @param directory the directory that contains the files to archive.
* @throws IOException if an I/O error occurs
* @throws ArchiveException if the archive cannot be created for other reasons
*/
public void create(String format, SeekableByteChannel target, File directory)
throws IOException, ArchiveException {
if (!prefersSeekableByteChannel(format)) {
create(format, Channels.newOutputStream(target), directory);
} else if (ArchiveStreamFactory.ZIP.equalsIgnoreCase(format)) {
create(new ZipArchiveOutputStream(target), directory);
} else if (ArchiveStreamFactory.SEVEN_Z.equalsIgnoreCase(format)) {
create(new SevenZOutputFile(target), directory);
} else {
// never reached as prefersSeekableByteChannel only returns true for ZIP and 7z
throw new ArchiveException("don't know how to handle format " + format);
}
}
代码示例来源:origin: org.apache.commons/commons-compress
final ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out);
if (actualEncoding != null) {
zip.setEncoding(actualEncoding);
代码示例来源: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: org.apache.poi/poi-ooxml
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(fos);
代码示例来源:origin: org.apache.poi/poi-ooxml
protected void injectData(ZipEntrySource zipEntrySource, OutputStream out) throws IOException {
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(out);
try {
Enumeration<? extends ZipArchiveEntry> en = zipEntrySource.getEntries();
代码示例来源:origin: org.apache.poi/poi-ooxml
? (ZipArchiveOutputStream) outputStream : new ZipArchiveOutputStream(outputStream);
代码示例来源:origin: apache/tika
public void writeTo(Map<String, byte[]> parts, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
ZipArchiveOutputStream zip = new ZipArchiveOutputStream(entityStream);
zip.setMethod(ZipArchiveOutputStream.STORED);
for (Map.Entry<String, byte[]> entry : parts.entrySet()) {
zipStoreBuffer(zip, entry.getKey(), entry.getValue());
}
zip.close();
}
}
代码示例来源:origin: apache/tika
break;
case ZIP:
os = new ZipArchiveOutputStream(os);
break;
代码示例来源:origin: naver/ngrinder
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(os);
zos.setEncoding(charsetName);
FileInputStream fis = null;
代码示例来源:origin: org.codehaus.plexus/plexus-archiver
new ZipArchiveOutputStream( bufferedOutputStream( fileOutputStream( zipFile, "zip" ) ) );
zipArchiveOutputStream.setEncoding( encoding );
zipArchiveOutputStream.setCreateUnicodeExtraFields( this.getUnicodeExtraFieldPolicy() );
代码示例来源:origin: org.codehaus.plexus/plexus-archiver
new ZipArchiveOutputStream( bufferedOutputStream( fileOutputStream( getDestFile(), "jar" ) ) );
代码示例来源:origin: apache/tika
private static void repairCopy(File brokenZip, File fixedZip) {
try (ZipArchiveOutputStream outputStream = new ZipArchiveOutputStream(fixedZip)) {
try (InputStream is = new FileInputStream(brokenZip)) {
ZipArchiveInputStream zipArchiveInputStream = new ZipArchiveInputStream(is);
代码示例来源:origin: sonia.jgit/org.eclipse.jgit.archive
/**
* @since 4.0
*/
public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
Map<String, Object> o) throws IOException {
return applyFormatOptions(new ZipArchiveOutputStream(s), o);
}
代码示例来源:origin: com.walmartlabs.concord.it/concord-common-it
public static byte[] archive(URI uri, String depsDir) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out)) {
IOUtils.zip(zip, Paths.get(uri));
if (depsDir != null) {
IOUtils.zip(zip, Constants.Files.LIBRARIES_DIR_NAME + "/", Paths.get(depsDir));
}
}
return out.toByteArray();
}
代码示例来源:origin: org.apache.slider/slider-core
public static void zipDir(String zipFile, String dir) throws IOException {
File dirObj = new File(dir);
ZipArchiveOutputStream out = new ZipArchiveOutputStream(new FileOutputStream(zipFile));
log.info("Creating : {}", zipFile);
try {
addDir(dirObj, out, "");
} finally {
out.close();
}
}
代码示例来源:origin: org.alfresco/alfresco-repository
public void startExport()
{
// ALF-2016
zipStream = new ZipArchiveOutputStream(outputStream);
// NOTE: This encoding allows us to workaround bug...
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
zipStream.setEncoding("UTF-8");
zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
zipStream.setUseLanguageEncodingFlag(true);
zipStream.setFallbackToUTF8(true);
zipStream.setUseZip64(Zip64Mode.Always);
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public void export(ProcessKey processKey, OutputStream out) throws IOException {
String name = name(processKey);
if (cfg.isEnabled() && dao.isArchived(processKey)) {
try (InputStream in = store.get(name)) {
IOUtils.copy(in, out);
}
} else {
try (ZipArchiveOutputStream dst = new ZipArchiveOutputStream(out)) {
stateManager.export(processKey, zipTo(dst));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!