- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.mule.tck.ZipUtils.compress()
方法的一些代码示例,展示了ZipUtils.compress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtils.compress()
方法的具体详情如下:
包路径:org.mule.tck.ZipUtils
类名称:ZipUtils
方法名:compress
[英]Compress a set of resource files into a ZIP file
[中]将一组资源文件压缩为ZIP文件
代码示例来源:origin: mulesoft/mule
/**
* Generates a JAR file form the compiled files
*
* @param targetFolder folder containing the compiled files. Non null.
* @param jarName name of the JAR file. Non empty.
* @return
*/
protected File compressGeneratedFiles(File targetFolder, String jarName) {
checkArgument(targetFolder != null, "targetFolder cannot be byll");
checkArgument(!StringUtils.isEmpty(jarName), "jar name cannot be empty");
Collection<File> files = listFiles(targetFolder, TRUE, TRUE);
ZipUtils.ZipResource[] resources = getZipResources(targetFolder, files);
File targetFile = new File(targetFolder, jarName);
compress(targetFile, resources);
return targetFile;
}
代码示例来源:origin: mulesoft/mule
@Test
public void unzipsFileWithoutParentFolderEntry() throws Exception {
final String resourceName = "dummy.xml";
final String resourceAlias = "folder" + File.separator + resourceName;
final File compressedFile = new File(toDir, "test.zip");
compress(compressedFile, new ZipResource[] {new ZipResource(resourceName, resourceAlias)});
unzip(compressedFile, toDir);
assertThat(new File(new File(toDir, "folder"), resourceName).exists(), is(true));
}
代码示例来源:origin: mulesoft/mule
@Test
public void readsPackagesFromJar() throws Exception {
final ZipResource fooClass = new ZipResource("EchoTest.clazz", "org/foo/Foo.class");
final ZipResource barClass = new ZipResource("EchoTest.clazz", "org/bar/Bar.class");
final ZipResource[] zipResources = {fooClass, barClass};
final File jarFile = File.createTempFile("test", ".jar");
jarFile.delete();
ZipUtils.compress(jarFile, zipResources);
final Set<String> packages = packageExplorer.explore(jarFile.toURI()).getPackages();
assertThat(packages.size(), equalTo(2));
assertThat(packages, hasItem("org.foo"));
assertThat(packages, hasItem("org.bar"));
}
代码示例来源:origin: mulesoft/mule
@Test
public void load() throws Exception {
String pluginName = "plugin";
File plugin = pluginsFolder.newFile(pluginName + ".jar");
compress(plugin, new ZipUtils.ZipResource[] {});
pluginDescriptorLoader.load(plugin);
verify(artifactPluginDescriptorFactory).create(plugin, empty());
}
代码示例来源:origin: mulesoft/mule
@Test
public void doesNotUnzipAbsolutePaths() throws Exception {
final String resourceName = "dummy.xml";
final String resourceAlias = new File(resourceName).getAbsolutePath();
final File compressedFile = new File(toDir, "test.zip");
compress(compressedFile, new ZipResource[] {
new ZipResource(resourceName, resourceName),
new ZipResource(resourceName, resourceAlias)
});
thrownException.expect(InvalidZipFileException.class);
thrownException.expectMessage("Absolute paths are not allowed: " + resourceAlias);
unzip(compressedFile, toDir);
// make sure it did not extract other archive files
assertThat(new File(toDir, resourceName).exists(), is(false));
}
代码示例来源:origin: mulesoft/mule
@Test
public void doesNotUnzipExternalPaths() throws Exception {
final String resourceName = "dummy.xml";
final String resourceAlias = Paths.get("folder", "..", "..", resourceName).toString();
final File compressedFile = new File(toDir, "test.zip");
compress(compressedFile, new ZipResource[] {
new ZipResource(resourceName, resourceName),
new ZipResource(resourceName, resourceAlias)
});
thrownException.expect(InvalidZipFileException.class);
thrownException.expectMessage("External paths are not allowed: " + resourceAlias);
unzip(compressedFile, toDir);
// make sure it did not extract other archive files
assertThat(new File(toDir, resourceName).exists(), is(false));
}
代码示例来源:origin: mulesoft/mule
@Override
public File getArtifactFile() {
if (artifactFile == null) {
String fileName = getArtifactFileName();
final File tempFile = new File(getTempFolder(), fileName);
tempFile.deleteOnExit();
if (corrupted) {
buildBrokenJarFile(tempFile);
} else {
final List<ZipResource> zipResources = new LinkedList<>(resources);
zipResources.add(new ZipResource(getArtifactPomFile().getAbsolutePath(), getArtifactFileBundledPomPartialUrl()));
zipResources.add(new ZipResource(getArtifactPomPropertiesFile().getAbsolutePath(),
getArtifactFileBundledPomPropertiesPartialUrl()));
zipResources.addAll(getCustomResources());
compress(tempFile, zipResources.toArray(new ZipResource[0]));
}
artifactFile = new File(tempFile.getAbsolutePath());
}
return artifactFile;
}
代码示例来源:origin: org.mule.tests/mule-tests-unit
/**
* Generates a JAR file form the compiled files
*
* @param targetFolder folder containing the compiled files. Non null.
* @param jarName name of the JAR file. Non empty.
* @return
*/
protected File compressGeneratedFiles(File targetFolder, String jarName) {
checkArgument(targetFolder != null, "targetFolder cannot be byll");
checkArgument(!StringUtils.isEmpty(jarName), "jar name cannot be empty");
Collection<File> files = listFiles(targetFolder, TRUE, TRUE);
ZipUtils.ZipResource[] resources = getZipResources(targetFolder, files);
File targetFile = new File(targetFolder, jarName);
compress(targetFile, resources);
return targetFile;
}
代码示例来源:origin: org.mule.runtime/mule-core-tests
@Test
public void unzipsFileWithoutParentFolderEntry() throws Exception {
final String resourceName = "dummy.xml";
final String resourceAlias = "folder" + File.separator + resourceName;
final File compressedFile = new File(toDir, "test.zip");
compress(compressedFile, new ZipResource[] {new ZipResource(resourceName, resourceAlias)});
unzip(compressedFile, toDir);
assertThat(new File(new File(toDir, "folder"), resourceName).exists(), is(true));
}
代码示例来源:origin: org.mule.runtime/mule-module-deployment-model-impl
@Test
public void load() throws Exception {
String pluginName = "plugin";
File plugin = pluginsFolder.newFile(pluginName + ".jar");
compress(plugin, new ZipUtils.ZipResource[] {});
pluginDescriptorLoader.load(plugin);
verify(artifactPluginDescriptorFactory).create(plugin, empty());
}
代码示例来源:origin: org.mule.runtime/mule-core-tests
@Test
public void doesNotUnzipAbsolutePaths() throws Exception {
final String resourceName = "dummy.xml";
final String resourceAlias = new File(resourceName).getAbsolutePath();
final File compressedFile = new File(toDir, "test.zip");
compress(compressedFile, new ZipResource[] {
new ZipResource(resourceName, resourceName),
new ZipResource(resourceName, resourceAlias)
});
thrownException.expect(InvalidZipFileException.class);
thrownException.expectMessage("Absolute paths are not allowed: " + resourceAlias);
unzip(compressedFile, toDir);
// make sure it did not extract other archive files
assertThat(new File(toDir, resourceName).exists(), is(false));
}
代码示例来源:origin: org.mule.runtime/mule-core-tests
@Test
public void doesNotUnzipExternalPaths() throws Exception {
final String resourceName = "dummy.xml";
final String resourceAlias = Paths.get("folder", "..", "..", resourceName).toString();
final File compressedFile = new File(toDir, "test.zip");
compress(compressedFile, new ZipResource[] {
new ZipResource(resourceName, resourceName),
new ZipResource(resourceName, resourceAlias)
});
thrownException.expect(InvalidZipFileException.class);
thrownException.expectMessage("External paths are not allowed: " + resourceAlias);
unzip(compressedFile, toDir);
// make sure it did not extract other archive files
assertThat(new File(toDir, resourceName).exists(), is(false));
}
本文整理了Java中jodd.io.ZipUtil.addToZip()方法的一些代码示例,展示了ZipUtil.addToZip()的具体用法。这些代码示例主要来源于Github/Stackover
本文整理了Java中jodd.io.ZipUtil.addFolderToZip()方法的一些代码示例,展示了ZipUtil.addFolderToZip()的具体用法。这些代码示例主要来源于Gith
本文整理了Java中jodd.io.ZipUtil.close()方法的一些代码示例,展示了ZipUtil.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
本文整理了Java中jodd.io.ZipUtil.unzip()方法的一些代码示例,展示了ZipUtil.unzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
本文整理了Java中jodd.io.ZipUtil.zlib()方法的一些代码示例,展示了ZipUtil.zlib()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mav
本文整理了Java中jodd.io.ZipUtil.gzip()方法的一些代码示例,展示了ZipUtil.gzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mav
本文整理了Java中jodd.io.ZipUtil.ungzip()方法的一些代码示例,展示了ZipUtil.ungzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow
本文整理了Java中jodd.io.ZipUtil.zip()方法的一些代码示例,展示了ZipUtil.zip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven
本文整理了Java中org.zeroturnaround.zip.ZipUtil.pack()方法的一些代码示例,展示了ZipUtil.pack()的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中org.zeroturnaround.zip.ZipUtil.unpackEntry()方法的一些代码示例,展示了ZipUtil.unpackEntry()的具体用法。这些代码示例
本文整理了Java中org.zeroturnaround.zip.ZipUtil.removeEntry()方法的一些代码示例,展示了ZipUtil.removeEntry()的具体用法。这些代码示例
本文整理了Java中org.zeroturnaround.zip.ZipUtil.packEntries()方法的一些代码示例,展示了ZipUtil.packEntries()的具体用法。这些代码示例
本文整理了Java中org.zeroturnaround.zip.ZipUtil.containsEntry()方法的一些代码示例,展示了ZipUtil.containsEntry()的具体用法。这些
本文整理了Java中org.zeroturnaround.zip.ZipUtil.unpack()方法的一些代码示例,展示了ZipUtil.unpack()的具体用法。这些代码示例主要来源于Githu
本文整理了Java中org.zeroturnaround.zip.ZipUtil.addOrReplaceEntries()方法的一些代码示例,展示了ZipUtil.addOrReplaceEntri
本文整理了Java中org.zeroturnaround.zip.ZipUtil.iterate()方法的一些代码示例,展示了ZipUtil.iterate()的具体用法。这些代码示例主要来源于Git
本文整理了Java中org.openl.util.ZipUtils.archive()方法的一些代码示例,展示了ZipUtils.archive()的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中org.openl.util.ZipUtils.extractAll()方法的一些代码示例,展示了ZipUtils.extractAll()的具体用法。这些代码示例主要来源于Git
本文整理了Java中org.mule.tck.ZipUtils.compress()方法的一些代码示例,展示了ZipUtils.compress()的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中aQute.lib.zip.ZipUtil.setModifiedTime()方法的一些代码示例,展示了ZipUtil.setModifiedTime()的具体用法。这些代码示例主
我是一名优秀的程序员,十分优秀!