FileDocCategorySizeDatePackage
ZipEntryFileProxy.javaAPI DocExample2263Mon Jan 09 11:01:58 GMT 2006None

ZipEntryFileProxy

public class ZipEntryFileProxy extends DebugFile

Fields Summary
ZipFileProxy
zip
ZipFile
zipfile
String
name
String
path
File
parent
ZipEntry
entry
Constructors Summary
public ZipEntryFileProxy(ZipFileProxy zip, ZipFile zipfile, String path, File parent)

        super("");
        this.zip = zip;
        this.zipfile = zipfile;
        this.path = path;
        this.parent = parent;
        this.entry = zipfile.getEntry(path);

        // determine if the entry is a directory
        String tmp = path;
        
        if(entry.isDirectory()) {
            tmp = path.substring(0,path.length()-1);
        }
        
        // then calculate the name
        int brk = tmp.lastIndexOf("/");
        name = path;
        if(brk != -1) {
            name = tmp.substring(brk+1);
        }
    
Methods Summary
public booleanequals(java.lang.Object obj)

        if(obj instanceof ZipEntryFileProxy) {
            ZipEntryFileProxy zo = (ZipEntryFileProxy)obj;
            if(zo.getAbsolutePath().equals(getAbsolutePath())) {
                return true;
            }
        }
        return false;
    
public booleanexists()

 return true; 
public java.io.FilegetAbsoluteFile()

 return this; 
public java.lang.StringgetAbsolutePath()

 return path; 
public java.io.FilegetCanonicalFile()

 return this; 
public java.io.InputStreamgetInputStream()

        return zipfile.getInputStream(entry);
    
public java.lang.StringgetName()

 return name; 
public java.io.FilegetParentFile()

 return parent; 
public java.lang.StringgetPath()

 return path; 
public inthashCode()

        return name.hashCode() ^ 1234321;
    
public booleanisAbsolute()

 return true; 
public booleanisDirectory()

 return entry.isDirectory(); 
public java.io.File[]listFiles()

        Map children = (Map)zip.hash.get(path);
        File[] files = new File[children.size()];
        Iterator it = children.keySet().iterator();
        int count = 0;
        while(it.hasNext()) {
            String name = (String)it.next();
            files[count] = new ZipEntryFileProxy(zip, zipfile, name,this);
            count++;
        }
        return files;