Method from com.sun.tools.javac.file.ZipArchive Detail: |
void addZipEntry(ZipEntry entry) {
String name = entry.getName();
int i = name.lastIndexOf('/');
RelativeDirectory dirname = new RelativeDirectory(name.substring(0, i+1));
String basename = name.substring(i+1);
if (basename.length() == 0)
return;
List< String > list = map.get(dirname);
if (list == null)
list = List.nil();
list = list.prepend(basename);
map.put(dirname, list);
}
|
public void close() throws IOException {
zfile.close();
}
|
public boolean contains(RelativePath name) {
RelativeDirectory dirname = name.dirname();
String basename = name.basename();
if (basename.length() == 0)
return false;
List< String > list = map.get(dirname);
return (list != null && list.contains(basename));
}
|
public JavaFileObject getFileObject(RelativeDirectory subdirectory,
String file) {
ZipEntry ze = new RelativeFile(subdirectory, file).getZipEntry(zfile);
return new ZipFileObject(this, file, ze);
}
|
public List<String> getFiles(RelativeDirectory subdirectory) {
return map.get(subdirectory);
}
|
public Set<RelativeDirectory> getSubdirectories() {
return map.keySet();
}
|
protected void initMap() throws IOException {
for (Enumeration< ? extends ZipEntry > e = zfile.entries(); e.hasMoreElements(); ) {
ZipEntry entry;
try {
entry = e.nextElement();
} catch (InternalError ex) {
IOException io = new IOException();
io.initCause(ex); // convenience constructors added in Mustang :-(
throw io;
}
addZipEntry(entry);
}
}
|
public String toString() {
return "ZipArchive[" + zfile.getName() + "]";
}
|