final List<ZipFileObject> strongRef = new ArrayList<ZipFileObject>(getZipFile().size());
final Enumeration<? extends ZipEntry> entries = getZipFile().entries();
while (entries.hasMoreElements())
{
final ZipEntry entry = entries.nextElement();
final AbstractFileName name = (AbstractFileName) getFileSystemManager().resolveName(getRootName(),
UriParser.encode(entry.getName()));
// Create the file
ZipFileObject fileObj;
if (entry.isDirectory() && getFileFromCache(name) != null)
{
fileObj = (ZipFileObject) getFileFromCache(name);
fileObj.setZipEntry(entry);
continue;
}
fileObj = createZipFileObject(name, entry);
putFileToCache(fileObj);
strongRef.add(fileObj);
fileObj.holdObject(strongRef);
// Make sure all ancestors exist
// TODO - create these on demand
ZipFileObject parent;
for (AbstractFileName parentName = (AbstractFileName) name.getParent();
parentName != null;
fileObj = parent, parentName = (AbstractFileName) parentName.getParent())
{
// Locate the parent
parent = (ZipFileObject) getFileFromCache(parentName);