Java 压缩文件的压缩

Java 压缩文件的压缩,java,Java,我试图确定zipEntry(zip文件的)是否是目录,但测试返回false //entryName is the name of a directory inside of the zip file File file = new File (entryName); if(file.isDirectory()){ ...} 使用Java 7提供的新ZIP文件系统: final Path path = Paths.get("/path/to/my.zip"); final String uri

我试图确定zipEntry(zip文件的)是否是目录,但测试返回false

//entryName is the name of a directory inside of the zip file
File file = new File (entryName);
if(file.isDirectory()){ ...}

使用Java 7提供的新ZIP文件系统:

final Path path = Paths.get("/path/to/my.zip");
final String uri = "jar:" + path.toUri().toString();

try (
    final FileSystem fs = FileSystems.newFileSystem(URI.create(str),
       Collections.<String, String>emptyMap(), null);
) {
    return Files.isDirectory(fs.getPath("/path/into/zip/file"));
}
final Path=Path.get(“/Path/to/my.zip”);
最后一个字符串uri=“jar:”+path.toUri().toString();
试一试(
最终文件系统fs=FileSystems.newFileSystem(URI.create(str),
Collections.emptyMap(),null);
) {
返回Files.isDirectory(fs.getPath(“/path/into/zip/file”);
}

为什么不阅读文档?非常感谢。我懂了