本文整理了Java中org.apache.tools.zip.ZipOutputStream.setMethod()
方法的一些代码示例,展示了ZipOutputStream.setMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipOutputStream.setMethod()
方法的具体详情如下:
包路径:org.apache.tools.zip.ZipOutputStream
类名称:ZipOutputStream
方法名:setMethod
[英]Sets the default compression method for subsequent entries.
Default is DEFLATED.
[中]设置后续条目的默认压缩方法。
违约率下降。
代码示例来源:origin: org.apache.ant/ant
zOut.setUseZip64(getZip64Mode().getMode());
if (isCompress()) {
zOut.setMethod(ZipOutputStream.DEFLATED);
} else {
zOut.setMethod(ZipOutputStream.STORED);
代码示例来源:origin: org.apache.ant/ant
getPolicy());
zOut.setFallbackToUTF8(fallBackToUTF8);
zOut.setMethod(doCompress
? ZipOutputStream.DEFLATED : ZipOutputStream.STORED);
zOut.setLevel(level);
代码示例来源:origin: org.gradle/gradle-core
public ZipOutputStream createArchiveOutputStream(File destination) throws IOException {
ZipOutputStream outStream = new ZipOutputStream(destination);
try {
outStream.setUseZip64(zip64Mode);
outStream.setMethod(entryCompressionMethod);
return outStream;
} catch (Exception e) {
IOUtils.closeQuietly(outStream);
String message = String.format("Unable to create ZIP output stream for file %s.", destination);
throw new UncheckedIOException(message, e);
}
}
代码示例来源:origin: com.github.tianjing/tgtools.core
/**
* 初始化 设置输出流
*
* @param p_OutputStream
*/
public void init(OutputStream p_OutputStream) {
if (null != p_OutputStream) {
m_ZipOutputStream = new ZipOutputStream(new CheckedOutputStream(p_OutputStream,
new CRC32()));
} else {
m_ZipOutputStream = new ZipOutputStream(new CheckedOutputStream(new ByteArrayOutputStream(), new CRC32()));
}
// 支持中文
m_ZipOutputStream.setEncoding(m_Encode);
// 启用压缩
m_ZipOutputStream.setMethod(ZipOutputStream.DEFLATED);
// 压缩级别为最强压缩,但时间要花得多一点
m_ZipOutputStream.setLevel(m_ZipLevel);
}
代码示例来源:origin: com.github.tianjing/tgtools.core
private static ZipOutputStream createZipOutputStream(OutputStream p_OutputSteam,String p_Comment)
{
CheckedOutputStream csum = new CheckedOutputStream(p_OutputSteam,
new CRC32());
ZipOutputStream zos = new ZipOutputStream(csum);
// 支持中文
zos.setEncoding("GBK");
// 设置压缩包注释
zos.setComment(p_Comment);
// 启用压缩
zos.setMethod(ZipOutputStream.DEFLATED);
// 压缩级别为最强压缩,但时间要花得多一点
zos.setLevel(Deflater.BEST_COMPRESSION);
return zos;
}
代码示例来源:origin: com.github.tianjing/tgtools.core
zos.setMethod(ZipOutputStream.DEFLATED);
代码示例来源:origin: hyperic/hq
zip_out = new ZipOutputStream(new BufferedOutputStream(file_out));
zip_out.setLevel(Deflater.BEST_COMPRESSION);
zip_out.setMethod(Deflater.DEFLATED);
内容来源于网络,如有侵权,请联系作者删除!