から簡単な名前を取得できるかどうかはわかりZipEntry
ます...
エントリの を呼び出すとgetName()
、フル パス名が取得されます。
ファイルの名前だけを取得する必要があります。
ここでは、ルートを含む完全な名前ではなく、単純な名前を取得する必要があります。
public class ZipFileSample {
public static void main(String[] args) {
try {
ZipFile zip = new ZipFile(new File("C:\\Users\\Levi\\Desktop\\jessica.zip"));
for (Enumeration e = zip.entries(); e.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry) e.nextElement();
//Here I need to get the simple name instead the full name with its root
System.out.println(entry.getName());
}
} catch (ZipException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}