1 package com.quadcap.io.dir; 2 3 40 41 import java.io.File ; 42 import java.io.IOException ; 43 44 import java.util.Enumeration ; 45 46 import java.net.MalformedURLException ; 47 import java.net.URL ; 48 49 54 public abstract class Directory { 55 public abstract Enumeration entries(); 56 public abstract Entry getEntry(String name); 57 public abstract URL getURL(String name) throws MalformedURLException ; 58 public abstract String getRealPath(String name); 59 public abstract String getRootPath(); 60 public abstract void close() throws IOException ; 61 public abstract boolean isFile(); 62 63 public static Directory getDirectory(File f) throws IOException { 64 if (f.isDirectory()) { 65 return new FileDirectory(f); 66 } else if (f.exists()) { 67 return new JarDirectory(f); 68 } else { 69 throw new IOException ("Can't open: " + f.getAbsolutePath()); 70 } 71 } 72 } 73 | Popular Tags |