本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.setLevel()
方法的一些代码示例,展示了ZipArchiveOutputStream.setLevel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipArchiveOutputStream.setLevel()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
类名称:ZipArchiveOutputStream
方法名:setLevel
[英]Sets the compression level for subsequent entries.
Default is Deflater.DEFAULT_COMPRESSION.
[中]设置后续条目的压缩级别。
违约是通货紧缩。默认的压缩。
代码示例来源:origin: com.atlassian.jira/jira-core
out.setLevel(ZipArchiveOutputStream.DEFAULT_COMPRESSION);
try
代码示例来源:origin: USPTO/PatentPublicData
@Override
public void open() throws IOException {
outputZip = new ZipArchiveOutputStream(filePath.toFile());
outputZip.setEncoding("UTF-8");
outputZip.setLevel(9);
ZipArchiveEntry zipEntry = new ZipArchiveEntry("corpus.xml");
outputZip.putArchiveEntry(zipEntry);
}
代码示例来源:origin: org.jetbrains.xodus/xodus-compress
final ZipArchiveOutputStream zipArchive =
new ZipArchiveOutputStream(new BufferedOutputStream(new FileOutputStream(target)));
zipArchive.setLevel(Deflater.BEST_COMPRESSION);
archive = zipArchive;
} else {
代码示例来源:origin: org.mycore/mycore-iview2
try {
final ZipArchiveOutputStream zipStream = new ZipArchiveOutputStream(new BufferedOutputStream(out));
zipStream.setLevel(Deflater.BEST_SPEED);
SimpleFileVisitor<java.nio.file.Path> zipper = new SimpleFileVisitor<java.nio.file.Path>() {
@Override
代码示例来源:origin: google/graphicsfuzz
zos.setLevel(0);
代码示例来源:origin: apache/sis
final File targetFile = distributionFile(rootDirectory, artifactBase + ".zip");
try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(targetFile)) {
zip.setLevel(9);
appendRecursively(sourceDirectory, artifactBase, zip);
代码示例来源:origin: org.mycore/mycore-sword
public static MediaResource getZippedDerivateMediaResource(String object) {
final Path tempFile;
try {
tempFile = Files.createTempFile("swordv2_", ".temp.zip");
} catch (IOException e) {
throw new MCRException("Could not create temp file!", e);
}
try (final OutputStream tempFileStream = Files.newOutputStream(tempFile)) {
final ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(tempFileStream);
zipOutputStream.setLevel(Deflater.BEST_COMPRESSION);
final MCRPath root = MCRPath.getPath(object, "/");
addDirectoryToZip(zipOutputStream, root);
zipOutputStream.close();
} catch (IOException e) {
throw new MCRException(e);
}
MediaResource resultRessource;
InputStream is;
try {
is = new MCRDeleteFileOnCloseFilterInputStream(Files.newInputStream(tempFile), tempFile);
resultRessource = new MediaResource(is, MCRSwordConstants.MIME_TYPE_APPLICATION_ZIP,
UriRegistry.PACKAGE_SIMPLE_ZIP);
} catch (IOException e) {
throw new MCRException("could not read from temp file!", e);
}
return resultRessource;
}
代码示例来源:origin: org.apache.ant/ant-compress
private void configure(ZipArchiveOutputStream o) {
o.setLevel(level);
o.setComment(comment);
o.setFallbackToUTF8(fallBackToUTF8);
o.setUseLanguageEncodingFlag(useLanguageEncodingFlag);
o.setCreateUnicodeExtraFields(createUnicodeExtraFields.getPolicy());
o.setUseZip64(zip64Mode.getPolicy());
}
代码示例来源:origin: core-lib/xjar
@Override
public void decrypt(XKey key, InputStream in, OutputStream out) throws IOException {
ZipArchiveInputStream zis = null;
ZipArchiveOutputStream zos = null;
try {
zis = new ZipArchiveInputStream(in);
zos = new ZipArchiveOutputStream(out);
zos.setLevel(level);
XUnclosedOutputStream nos = new XUnclosedOutputStream(zos);
ZipArchiveEntry entry;
while ((entry = zis.getNextZipEntry()) != null) {
if (entry.isDirectory()) {
continue;
}
zos.putArchiveEntry(new ZipArchiveEntry(entry.getName()));
XDecryptor decryptor = filtrate(entry) ? this : xNopDecryptor;
try (OutputStream eos = decryptor.decrypt(key, nos)) {
XKit.transfer(zis, eos);
}
zos.closeArchiveEntry();
}
zos.finish();
} finally {
XKit.close(zis);
XKit.close(zos);
}
}
代码示例来源:origin: core-lib/xjar
@Override
public void encrypt(XKey key, InputStream in, OutputStream out) throws IOException {
ZipArchiveInputStream zis = null;
ZipArchiveOutputStream zos = null;
try {
zis = new ZipArchiveInputStream(in);
zos = new ZipArchiveOutputStream(out);
zos.setLevel(level);
XUnclosedOutputStream nos = new XUnclosedOutputStream(zos);
ZipArchiveEntry entry;
while ((entry = zis.getNextZipEntry()) != null) {
if (entry.isDirectory()) {
continue;
}
zos.putArchiveEntry(new ZipArchiveEntry(entry.getName()));
XEncryptor encryptor = filtrate(entry) ? this : xNopEncryptor;
try (OutputStream eos = encryptor.encrypt(key, nos)) {
XKit.transfer(zis, eos);
}
zos.closeArchiveEntry();
}
zos.finish();
} finally {
XKit.close(zis);
XKit.close(zos);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!