- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中java.util.zip.ZipOutputStream.setMethod()
方法的一些代码示例,展示了ZipOutputStream.setMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipOutputStream.setMethod()
方法的具体详情如下:
包路径:java.util.zip.ZipOutputStream
类名称:ZipOutputStream
方法名:setMethod
[英]Sets the default compression method to be used when a ZipEntry doesn't explicitly specify a method. See ZipEntry#setMethod for more details.
[中]设置ZipEntry未显式指定方法时使用的默认压缩方法。有关更多详细信息,请参见ZipEntry#setMethod。
代码示例来源:origin: iBotPeaches/Apktool
out.setMethod(ZipOutputStream.STORED);
CRC32 crc = new CRC32();
crc.update(data);
代码示例来源:origin: org.apache.ant/ant
output.setMethod(ZipOutputStream.DEFLATED);
output.setLevel(Deflater.DEFAULT_COMPRESSION);
} else {
output.setMethod(ZipOutputStream.STORED);
代码示例来源:origin: ankidroid/Anki-Android
try {
ZipOutputStream z = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(f)));
z.setMethod(ZipOutputStream.DEFLATED);
代码示例来源:origin: pentaho/pentaho-kettle
out.setMethod( ZipOutputStream.DEFLATED );
out.setLevel( Deflater.BEST_COMPRESSION );
代码示例来源:origin: pentaho/pentaho-kettle
out.setMethod( ZipOutputStream.DEFLATED );
代码示例来源:origin: wizzardo/tools
public ZipWriter setMethod(int method) {
out.setMethod(method);
return this;
}
代码示例来源:origin: asakusafw/asakusafw
Writer(OutputStream output) throws IOException {
if (output == null) {
throw new IllegalArgumentException("output must not be null"); //$NON-NLS-1$
}
this.output = new ZipOutputStream(output);
this.output.setMethod(ZipOutputStream.DEFLATED);
this.output.setLevel(0);
this.output.putNextEntry(new ZipEntry(FIRST_ENTRY_NAME));
this.output.closeEntry();
}
代码示例来源:origin: org.databene/databene-commons
public static void compress(File source, File zipFile) throws IOException {
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
out.setMethod(ZipOutputStream.DEFLATED);
try {
addFileOrDirectory(source, source, out);
out.close();
} catch (IOException e) {
throw new RuntimeException("Zipping the report failed");
}
}
代码示例来源:origin: stackoverflow.com
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(target));
zos.setMethod( ZipOutputStream.DEFLATED );
zos.setLevel( 5 );
...
代码示例来源:origin: stackoverflow.com
// Zip
ZipOutputStream zipOut = ...
zipOut.setMethod(ZipOutputStream.STORED); // No compression.
for(int i = 0; i < tableModel.getRowCount(); i++) {
// Single file
File originalFile = (File) tableModel.getValueAt(i, 0);
FileInputStream originalStream = new FileInputStream(originalFile);
// GZipped single file:
GZipOutputStream gzipOut = ...; ...
// Input of the gzipped thing
InputStream gzipResultIn = ...
// Make a new ZipEntry:
ZipEntry zipEntry = new ZipEntry(originalFile.getName()
+ ".gz.enc");
zipOut.putNextEntry(zipEntry);
encrypt(key, gzipResultIn, zipOut); // Should not close the input
zipOut.closeEntry();
}
zipOut.close();
代码示例来源:origin: org.terracotta/terracotta-ee
public ZipBuilder(File archiveFile, boolean useCompression, boolean verbose) throws IOException {
zout = getArchiveOutputStream(archiveFile);
if (useCompression) {
zout.setMethod(ZipEntry.DEFLATED);
zout.setLevel(9);
} else {
zout.setMethod(ZipEntry.STORED);
zout.setLevel(0);
}
this.verbose = verbose;
}
代码示例来源:origin: org.terracotta/terracotta-l1
public ZipBuilder(File archiveFile, boolean useCompression, boolean verbose) throws IOException {
zout = getArchiveOutputStream(archiveFile);
if (useCompression) {
zout.setMethod(ZipEntry.DEFLATED);
zout.setLevel(9);
} else {
zout.setMethod(ZipEntry.STORED);
zout.setLevel(0);
}
this.verbose = verbose;
}
代码示例来源:origin: diffplug/goomph
/**
* Creates a single-entry zip file.
*
* @param input an uncompressed file
* @param pathWithinArchive the path within the archive
* @param output the new zip file it will be compressed into
*/
public static void zip(File input, String pathWithinArchive, File output) throws IOException {
try (ZipOutputStream zipStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(output)))) {
zipStream.setMethod(ZipOutputStream.DEFLATED);
zipStream.setLevel(9);
zipStream.putNextEntry(new ZipEntry(pathWithinArchive));
try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(input))) {
copy(inputStream, zipStream);
}
}
}
代码示例来源:origin: org.terracotta/terracotta-l1-ee
public ZipBuilder(File archiveFile, boolean useCompression, boolean verbose) throws IOException {
zout = getArchiveOutputStream(archiveFile);
if (useCompression) {
zout.setMethod(ZipEntry.DEFLATED);
zout.setLevel(9);
} else {
zout.setMethod(ZipEntry.STORED);
zout.setLevel(0);
}
this.verbose = verbose;
}
代码示例来源:origin: Geomatys/geotoolkit
/**
* Intermediate operation during ip creation
* @param method
* @param level
* @param buf
* @param resources
* @throws IOException
*/
private static void zipCore(int method, int level, BufferedOutputStream buf, Path[] resources) throws IOException {
try (final ZipOutputStream zout = new ZipOutputStream(buf)) {
zout.setMethod(method);
zout.setLevel(level);
zipCore(zout, method, level, "", Arrays.asList(resources).iterator());
}
}
代码示例来源:origin: jasperreports/jasperreports
/**
*
*/
public void zipEntries(OutputStream os) throws IOException
{
ZipOutputStream zipos = new ZipOutputStream(os);
zipos.setMethod(ZipOutputStream.DEFLATED);
for (int i = 0; i < exportZipEntries.size(); i++)
{
ExportZipEntry oasisZipEntry = (ExportZipEntry)exportZipEntries.get(i);
ZipEntry zipEntry = new ZipEntry(oasisZipEntry.getName());
zipos.putNextEntry(zipEntry);
oasisZipEntry.writeData(zipos);
}
zipos.flush();
zipos.finish();
}
代码示例来源:origin: apache/jackrabbit
/**
* @see DefaultHandler#exportData(ExportContext,boolean,Node)
*/
@Override
protected void exportData(ExportContext context, boolean isCollection, Node contentNode) throws IOException, RepositoryException {
ZipOutputStream zout = new ZipOutputStream(context.getOutputStream());
zout.setMethod(ZipOutputStream.DEFLATED);
try {
int pos = contentNode.getPath().length();
exportZipEntry(context, zout, contentNode, pos > 1 ? pos+1 : pos);
} finally {
zout.finish();
}
}
代码示例来源:origin: MCMrARM/revolution-irc
private static void buildThemeZipFile(File zipPath, ResTable resTable) {
try {
FileOutputStream fos = new FileOutputStream(zipPath);
ZipOutputStream outStream = new ZipOutputStream(new BufferedOutputStream(fos));
outStream.setMethod(ZipOutputStream.STORED);
ByteArrayOutputStream byteArrOS = new ByteArrayOutputStream();
ArscWriter writer = new ArscWriter(resTable);
writer.write(byteArrOS);
byte[] bytes = byteArrOS.toByteArray();
ZipEntry entry = new ZipEntry("resources.arsc");
entry.setSize(bytes.length);
CRC32 crc = new CRC32();
crc.update(bytes);
entry.setCrc(crc.getValue());
outStream.putNextEntry(entry);
outStream.write(bytes);
outStream.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: pentaho/pentaho-reporting
public void writeContent( final ZipEntry entry,
final InputStream in,
final int method,
final int compression ) throws IOException {
zipOutputStream.setMethod( method );
zipOutputStream.setLevel( compression );
zipOutputStream.putNextEntry( entry );
IOUtils.getInstance().copyStreams( in, zipOutputStream );
zipOutputStream.closeEntry();
}
}
代码示例来源:origin: com.github.danny02/Geometrie
@Override
public void writeModel(OutputStream out, Model[] models) throws IOException {
ZipOutputStream zip = new ZipOutputStream(out);
zip.setMethod(ZipOutputStream.STORED);
for (int i = 0; i < models.length; i++) {
ZipEntry zipEntry = new ZipEntry("model" + i + ".ctm");
ByteArrayOutputStream buf = new ByteArrayOutputStream();
writeSingleModel(buf, models[i]);
byte[] toByteArray = buf.toByteArray();
CRC32 c = new CRC32();
c.update(toByteArray);
zipEntry.setSize(toByteArray.length);
zipEntry.setCompressedSize(toByteArray.length);
zipEntry.setCrc(c.getValue());
zip.putNextEntry(zipEntry);
zip.write(toByteArray);
zip.closeEntry();
}
zip.finish();
}
最近几天我一直在努力学习类和对象,我意识到在构造函数中使用“this.set”和“set”并没有明显的区别。澄清 public Movie(String title,String director,
本文整理了Java中ij.plugin.ZProjector.setMethod()方法的一些代码示例,展示了ZProjector.setMethod()的具体用法。这些代码示例主要来源于Github
我有兴趣为泛型函数设置新方法。例如,假设我有一个新类(class)(例如 coolClass)。我可以编写一个包装器来计算该类的 log10 并使用以下代码轻松设置该方法: setMethod("Ma
本文整理了Java中java.util.zip.ZipOutputStream.setMethod()方法的一些代码示例,展示了ZipOutputStream.setMethod()的具体用法。这些代
本文整理了Java中java.util.zip.ZipEntry.setMethod()方法的一些代码示例,展示了ZipEntry.setMethod()的具体用法。这些代码示例主要来源于Github
为标题道歉,不知道如何表达这个问题。 如果我想创建 setMethod在一个类(class)上如何区分mat[i,]的类似情况和 mat[i] ? 我知道我可以使用的前者: setMethod("["
题 在 r 中编程时与 s4 OOP系统,何时必须使用 setReplaceMethod ? 我看不出和 setMethod 有什么区别添加时 setReplaceMethod function (
我尝试使用传入的参数创建一个新对象,然后使用该新对象放置在下面列出的 setCarColor 方法中。但是我的构造函数中的 setCarColor 为我的 clv 变量提供了错误。它说“找不到符号”。
我正在尝试创建一个类Tax,它使用扫描仪变量从用户获取工资和税率,并使用用户的输入给出税后工资。 我收到的错误是 set-method 不能用于使用扫描仪变量。请提出解决方案。 代码如下:- pack
浏览 System.Linq.Expressions 的 .NET 核心源代码,我发现以下代码位于 here : MethodInfo mi = property.GetGetMethod(true)
本文整理了Java中org.apache.tools.zip.ZipOutputStream.setMethod()方法的一些代码示例,展示了ZipOutputStream.setMethod()的具
本文整理了Java中de.schlichtherle.truezip.zip.ZipEntry.setMethod()方法的一些代码示例,展示了ZipEntry.setMethod()的具体用法。这些
基本上,当 setMethod 或 (setGeneric) 中有很多参数时,它的运行速度会非常慢。 这是一个基本示例: setClassUnion(name = "mNumeric", member
所以,PropertyInfo 有一个 GetSetMethod 方法,它返回这个属性的 setter 方法。它还有一个 SetMethod 属性(据我所知)。 我问这个是因为如果属性不是公共(pub
经过几个小时的教程和谷歌搜索,我知道当我们在头文件中定义一个属性时,编译器会自动生成 setter 和 getter,这里是一个例子: “example.h” @property(strong,non
本文整理了Java中org.mozilla.zest.core.v1.ZestRequest.setMethod()方法的一些代码示例,展示了ZestRequest.setMethod()的具体用法。
我正在使用 setMethod 来覆盖不同类的对象的“摘要”函数。 最初,我使用了这种方法: setMethod('summary', "class_1", function(o
本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.setMethod()方法的一些代码示例,展示了Z
本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setMethod()方法的一些代码示例,展示了ZipArchi
我有一些现有代码可以创建 Epub 2 格式的 zip 文件,它可以正常工作。 在尝试更新我的代码以支持 Epub 3 格式时,我想我会尝试使用 Java NIO Zip 文件系统而不是 java.u
我是一名优秀的程序员,十分优秀!