I'm working on digital documents and digital signatures and I've stumbled upon a problem.
Input: documentX.adoc - zip file with files and folders inside.
I need to get all the content in the input file - a list of dirs and files.
What do I do:
ZipFile adocFile = new ZipFile(documentXFileName);
ArrayList <String> adocFiles = new ArrayList<String>();
Enumeration <? extends ZipEntry> entries;
entries = adocFile.entries();
for (entries = adocFile.entries(); entries.hasMoreElements();)
{
adocFiles.add(entries.nextElement().getName());
}
I've tried to create ArrayList < ZipEntry > and add ZipEntries instead of names - still nothing. Maybe there is some other way? Strange thing is, that ZipEntry has a .isDirectory() method...
Thanks for help, Martin
From the documentation:
A directory entry is defined to be one whose name ends with a '/'.
It is not necessary to store directories in a ZIP file - they are optional entries. It is possible to store a byte sequence with the path foo/bar.txt
without an entry called foo
. Zip tools may provide the illusion that such things exist within the archive even if they don't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With