1 30 31 package jbet; 32 import java.io.*; 33 import java.util.*; 34 35 44 45 public abstract class ClassPathElement { 46 public abstract InputStream get(String name) throws IOException; 47 public abstract OutputStream put (String name) throws IOException; 48 public abstract Iterator classes() throws IOException; 49 public abstract boolean class_exists(String name) throws IOException; 50 public abstract boolean subdir_exists(String name) throws IOException; 51 public abstract Iterator subdirs() throws IOException; 52 public abstract ClassPathElement subdir (String name) throws IOException; 53 public abstract boolean supports_subdir(); 54 public Iterator allclasses() throws IOException { 55 Vector ret = new Vector(); 56 findallclasses (ret, this); 57 return ret.iterator(); 58 } 59 private void findallclasses (Vector v, ClassPathElement cpe) throws IOException{ 60 for (Iterator i = cpe.classes(); i.hasNext();) 61 v.addElement (i.next()); 62 if (!supports_subdir()) return; 63 for (Iterator i = cpe.subdirs(); i.hasNext();) 64 findallclasses(v, cpe.subdir((String )i.next())); 65 } 66 } 67 68 69 | Popular Tags |