• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ZipEntryCallback类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.zeroturnaround.zip.ZipEntryCallback的典型用法代码示例。如果您正苦于以下问题:Java ZipEntryCallback类的具体用法?Java ZipEntryCallback怎么用?Java ZipEntryCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ZipEntryCallback类属于org.zeroturnaround.zip包,在下文中一共展示了ZipEntryCallback类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
@Test
public void test() throws IOException {
	PackageWriter packageWriter = new DefaultPackageWriter();
	Package pkgtoWrite = createSimplePackage();
	Path tempPath = Files.createTempDirectory("tests");
	File outputDirectory = tempPath.toFile();

	File zipFile = packageWriter.write(pkgtoWrite, outputDirectory);
	assertThat(zipFile).exists();
	assertThat(zipFile.getName()).isEqualTo("myapp-1.0.0.zip");
	ZipUtil.iterate(zipFile, new ZipEntryCallback() {
		@Override
		public void process(InputStream inputStream, ZipEntry zipEntry) throws IOException {
			if (zipEntry.getName().equalsIgnoreCase("package.yml")) {
				assertExpectedContents(inputStream, "package.yml");
			}
			if (zipEntry.getName().equalsIgnoreCase("values.yml")) {
				assertExpectedContents(inputStream, "values.yml");
			}
			if (zipEntry.getName().equals("myapp.yml")) {
				assertExpectedContents(inputStream, "generic-template.yml");
			}
		}
	});
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:26,代码来源:PackageWriterTests.java


示例2: compareOfflineAndOnline

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
public Map<String, List<Map<File, String>>> compareOfflineAndOnline(String onlineZipPath, String offlineDirPath) {

        File existFolder = new File(offlineDirPath);
        if (!existFolder.exists()) {
            return null;
        }
        Map<String, List<Map<File,String>>> result = new HashMap<>();
        result.put("update", new ArrayList<>());
        result.put("add", new ArrayList<>());
        ZipUtil.iterate(new File(onlineZipPath), new ZipEntryCallback() {
            @Override
            public void process(InputStream in, ZipEntry zipEntry) throws IOException {
                File fileOffline = new File(existFolder,zipEntry.getName());
                if(fileOffline.exists()) { // file for merge
                    if(zipEntry.getCrc() != getCrc(fileOffline.getAbsolutePath())) {
                        result.get("update").add(inputToMapping(in, fileOffline));
                    }
                } else { // file for add
                    result.get("add").add(inputToMapping(in, fileOffline));
                }
            }
        });
        return result;
    }
 
开发者ID:firm1,项目名称:zest-writer,代码行数:25,代码来源:DownloadContentService.java


示例3: testAllGamesFromArchive

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
@Test
public void testAllGamesFromArchive() {
  Path path = Paths.get("src/test/resources/games-aeb-cwi-nl.zip");
  ZipUtil.iterate(path.toFile(), new ZipEntryCallback() {

    @Override
    public void process(InputStream in, ZipEntry zipEntry) throws IOException {
      if (zipEntry.toString().endsWith("sgf")) {

        try {
          Sgf.createFromInputStream(in);
        }
        catch (SgfParseException e) {
          System.out.println("Problem with " + zipEntry.getName());
          e.printStackTrace();
          Assert.fail();
        }
      }
    }
  });
  Assert.assertTrue(true);
}
 
开发者ID:toomasr,项目名称:sgf4j,代码行数:23,代码来源:TestAebSet.java


示例4: processZip

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
private void processZip(final String zipName,
                        final Map<String, ClassInfo> foundClasses) {
  final File zip = new File(zipName);
  ZipUtil.iterate(zip, new ZipEntryCallback() {
    public void process(InputStream in, ZipEntry zipEntry) throws IOException {
      if ((!zipEntry.isDirectory()) && (zipEntry.getName().endsWith(".class"))) {
        try {
          log.trace("Loading " + zipName + "(" + zipEntry.getName() + ")");
          loadClassData(in, new ClassInfoClassVisitor(foundClasses, zip));
        } catch (ClassFinderException ex) {
          log.error("Can't open \"" + zipEntry.getName() + "\" in file \"" + zipName + "\": ", ex);
        }
      }
    }
  });
}
 
开发者ID:poolik,项目名称:classfinder,代码行数:17,代码来源:ParallelClassLoader.java


示例5: extractFromZip

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
/**
 * Extract files from zip archive, not recursive.
 *
 * @param uploadedFile uploaded zip file
 * @return collection of zip files.
 */
private Collection<UserFile> extractFromZip(UploadedFile uploadedFile) {
    LOGGER.info("Start extraction from zip file with name=" + uploadedFile.getName());
    final List<UserFile> userFiles = new ArrayList<UserFile>();
    ZipUtil.iterate(new ByteArrayInputStream(uploadedFile.getContent().getFileContent()), new ZipEntryCallback() {
        @Override
        public void process(InputStream inputStream, ZipEntry zipEntry) throws IOException {
            if (!zipEntry.isDirectory()) {
                byte[] content = IOUtils.toByteArray(inputStream);
                String xmlSchema = defaultString(xmlSchemaExtractor.extractXmlSchema(content), DUMMY_XML_SCHEMA);
                userFiles.add(new UserFile(new UploadedFile(zipEntry.getName(), content), xmlSchema));
            }
        }
    });
    LOGGER.info("Extracted " + userFiles.size() + " from zip archive.");
    return userFiles;
}
 
开发者ID:eea,项目名称:eionet.webq,代码行数:23,代码来源:MultipartFileToUserFileConverter.java


示例6: copySigarLibs

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
private void copySigarLibs(final File libDirectory, File sigarDistributionFile)
        throws MojoExecutionException {
    try {
        ZipUtil.iterate(sigarDistributionFile, new ZipEntryCallback() {
            @Override
            public void process(InputStream in, ZipEntry zipEntry) throws IOException {
                String zipEntryName = zipEntry.getName();
                if (zipEntryName.contains("sigar-bin/lib") && !zipEntryName.endsWith("/")) {
                    String compressedFileName = zipEntryName.substring(zipEntryName.lastIndexOf("/") + 1);
                    if (compressedFileName.endsWith(".so") || compressedFileName.endsWith(".dll") ||
                            compressedFileName.endsWith(".sl") || compressedFileName.endsWith(".dylib")
                            || compressedFileName.equals("sigar.jar")) {
                        File destinationFile = new File(libDirectory, compressedFileName);
                        copyStreamToFile(new RawInputStreamFacade(in), destinationFile);
                    }
                }
            }
        });
    } catch (Exception e) {
        throw new MojoExecutionException("Could not unpack Sigar file " + sigarDistributionFile
                .getAbsolutePath(), e);
    }
}
 
开发者ID:rhq-project,项目名称:rhq-agent-plugin-plugin,代码行数:24,代码来源:SetupTestPluginContainerMojo.java


示例7: assertZipWithFileHierarchy

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
private void assertZipWithFileHierarchy(Path archivePath) {
    final int[] nbEntries = { 0 };

    // Reads ZIP content using a third-party library
    ZipUtil.iterate(archivePath.toFile(), new ZipEntryCallback() {
        @Override
        public void process(InputStream in, ZipEntry zipEntry) throws IOException {
            nbEntries[0]++;
        }
    });

    assertThat(nbEntries[0]).isEqualTo(HIERARCHY_DEPTH + 1);
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:14,代码来源:VFSZipperZIPTest.java


示例8: getMinimizedEntries

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
private ZipEntrySource[] getMinimizedEntries(File minimizedJarFile, String currentArtifactFileName) {
    final Set<ZipEntrySource> resultEntriesSet = Sets.newHashSet();
    ZipUtil.iterate(minimizedJarFile, new ZipEntryCallback() {

        public void process(InputStream in, ZipEntry minimizedEntry) throws IOException {
            final String minimizedEntryName = minimizedEntry.getName();
            resultEntriesSet.add(new ByteSource(minimizedEntryName, readBytes(in)));
        }
    });
    return resultEntriesSet.toArray(new ZipEntrySource[resultEntriesSet.size()]);
}
 
开发者ID:Codarama,项目名称:diet-maven-mojo,代码行数:12,代码来源:JarArtifactPackager.java


示例9: getCurrentArtifactNames

import org.zeroturnaround.zip.ZipEntryCallback; //导入依赖的package包/类
private Set<String> getCurrentArtifactNames(File currentArtifactFile) {
    final Set<String> result = Sets.newHashSet();
    ZipUtil.iterate(currentArtifactFile, new ZipEntryCallback() {

        public void process(InputStream in, ZipEntry currentEntry) throws IOException {
            result.add(currentEntry.getName());
        }
    });

    return result;
}
 
开发者ID:Codarama,项目名称:diet-maven-mojo,代码行数:12,代码来源:JarArtifactPackager.java



注:本文中的org.zeroturnaround.zip.ZipEntryCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Identifier类代码示例发布时间:2022-05-23
下一篇:
Java UserFilter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap