本文整理了Java中org.jboss.windup.util.ZipUtil.scanZipFile()
方法的一些代码示例,展示了ZipUtil.scanZipFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtil.scanZipFile()
方法的具体详情如下:
包路径:org.jboss.windup.util.ZipUtil
类名称:ZipUtil
方法名:scanZipFile
暂无
代码示例来源:origin: org.jboss.windup.utils/windup-utils
public static List<String> scanZipFile(Path zipFilePath, boolean relativeOnly)
{
try
{
try (final InputStream is = new FileInputStream(zipFilePath.toFile()))
{
return scanZipFile(zipFilePath.normalize().toString(), is, relativeOnly);
}
}
catch (IOException e)
{
System.err.println("Could not read file: " + zipFilePath + " due to: " + e.getMessage());
return Collections.emptyList();
}
}
代码示例来源:origin: windup/windup
public static List<String> scanZipFile(Path zipFilePath, boolean relativeOnly)
{
try
{
try (final InputStream is = new FileInputStream(zipFilePath.toFile()))
{
return scanZipFile(zipFilePath.normalize().toString(), is, relativeOnly);
}
}
catch (IOException e)
{
System.err.println("Could not read file: " + zipFilePath + " due to: " + e.getMessage());
return Collections.emptyList();
}
}
代码示例来源:origin: org.jboss.windup.utils/windup-utils
public static List<String> scanZipFile(String parentPath, InputStream is, boolean relativeOnly)
{
try
{
ZipInputStream zis = new ZipInputStream(is);
ZipEntry entry;
List<String> results = new ArrayList<>();
while ((entry = zis.getNextEntry()) != null)
{
String fullPath = parentPath + "/" + entry.getName();
results.add(relativeOnly ? entry.getName() : fullPath);
if (!entry.isDirectory() && ZipUtil.endsWithZipExtension(entry.getName()))
{
results.addAll(scanZipFile(fullPath, zis, relativeOnly));
}
}
return results;
}
catch (IOException e)
{
System.err.println("Could not read file: " + parentPath + " due to: " + e.getMessage());
return Collections.emptyList();
}
}
代码示例来源:origin: windup/windup
public static List<String> scanZipFile(String parentPath, InputStream is, boolean relativeOnly)
{
try
{
ZipInputStream zis = new ZipInputStream(is);
ZipEntry entry;
List<String> results = new ArrayList<>();
while ((entry = zis.getNextEntry()) != null)
{
String fullPath = parentPath + "/" + entry.getName();
results.add(relativeOnly ? entry.getName() : fullPath);
if (!entry.isDirectory() && ZipUtil.endsWithZipExtension(entry.getName()))
{
results.addAll(scanZipFile(fullPath, zis, relativeOnly));
}
}
return results;
}
catch (IOException e)
{
System.err.println("Could not read file: " + parentPath + " due to: " + e.getMessage());
return Collections.emptyList();
}
}
代码示例来源:origin: org.jboss.windup/windup-bootstrap
private static List<String> findPaths(Path path, boolean relativeOnly)
{
List<String> results = new ArrayList<>();
results.add(path.normalize().toAbsolutePath().toString());
if (Files.isDirectory(path))
{
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path))
{
for (Path child : directoryStream)
{
results.addAll(findPaths(child, relativeOnly));
}
}
catch (IOException e)
{
System.err.println("Could not read file: " + path + " due to: " + e.getMessage());
}
}
else if (Files.isRegularFile(path) && ZipUtil.endsWithZipExtension(path.toString()))
{
results.addAll(ZipUtil.scanZipFile(path, relativeOnly));
}
return results;
}
代码示例来源:origin: windup/windup
private static List<String> findPaths(Path path, boolean relativeOnly)
{
List<String> results = new ArrayList<>();
results.add(path.normalize().toAbsolutePath().toString());
if (Files.isDirectory(path))
{
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path))
{
for (Path child : directoryStream)
{
results.addAll(findPaths(child, relativeOnly));
}
}
catch (IOException e)
{
System.err.println("Could not read file: " + path + " due to: " + e.getMessage());
}
}
else if (Files.isRegularFile(path) && ZipUtil.endsWithZipExtension(path.toString()))
{
results.addAll(ZipUtil.scanZipFile(path, relativeOnly));
}
return results;
}
代码示例来源:origin: org.jboss.windup.web.addons/windup-web-support-impl
private static List<String> findPaths(Path path, boolean relativeOnly)
{
List<String> results = new ArrayList<>();
results.add(path.normalize().toAbsolutePath().toString());
if (Files.isDirectory(path))
{
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path))
{
for (Path child : directoryStream)
{
results.addAll(findPaths(child, relativeOnly));
}
}
catch (IOException e)
{
Logger.getLogger(PackageDiscoveryServiceImpl.class).warn("Could not read file: " + path + " due to: " + e.getMessage());
}
}
else if (Files.isRegularFile(path) && ZipUtil.endsWithZipExtension(path.toString()))
{
results.addAll(ZipUtil.scanZipFile(path, relativeOnly));
}
return results;
}
}
内容来源于网络,如有侵权,请联系作者删除!