blob: 467e6b2165952e52c9320eff15459316c77d16d7 [file] [log] [blame]
package org.eclipse.epp.installer.launcher;
import java.io.IOException;
import org.eclipse.epp.installer.archive.Archive;
import org.eclipse.epp.installer.archive.ArchiveEntry;
import org.eclipse.epp.installer.archive.zip.DirSubArchive;
import org.eclipse.epp.installer.archive.zip.ZipSubArchive;
/**
* <p>
* Copyright (c) 2006, Instantiations, Inc.<br>
* All Rights Reserved
*/
public class Archives {
public static Archive getSubArchive(Archive archive, ArchiveEntry path) throws IOException{
String name = path.getName();
if(path.isDirectory())
return new DirSubArchive(archive, path);
if(name.endsWith(".jar") || name.endsWith(".zip") )
return new ZipSubArchive(archive, path);
return null;
}
public static Archive getSubArchive(Archive archive, String[] path) throws IOException{
for(int i=0; i<path.length; i++){
ArchiveEntry nextEntry = archive.getEntry(path[i]);
archive = getSubArchive(archive, nextEntry);
}
return archive;
}
}