我很难找到一个读取zip文件的解决方案。该zip文件带有字符串化的JSON,但该文件没有扩展名。
我尝试使用java.util.zip.ZipInputStream包中的API ZipInputStream部分,但代码永远不会进入下面的代码中提到的Sysout
InputStream initialStream = new FileInputStream(
new File("D:\\test_data.zip"));
ZipInputStream zipInputStream = new ZipInputStream(initialStream);
try {
ZipEntry entry;
while ((entry = zipInputStream.getNextEntry()) != null) {
System.out.printf("File: %s Size %d Modified on %TD %n", entry.getName(), entry.getSize(),
new Date(entry.getTime()));
}
} finally {
zipInputStream.close();
}