static public Class classForNameNonLoading(String name) { return classForName(name, false, baseLoader()); }
static public Class classForName(String name) { return classForName(name, true, baseLoader()); }
static void compile(String cljfile) throws IOException{ InputStream ins = resourceAsStream(baseLoader(), cljfile); if(ins != null) { try { Compiler.compile(new InputStreamReader(ins, UTF8), cljfile, cljfile.substring(1 + cljfile.lastIndexOf("/"))); } finally { ins.close(); } } else throw new FileNotFoundException("Could not locate Clojure resource on classpath: " + cljfile); }
public static void loadResourceScript(Class c, String name, boolean failIfNotFound) throws IOException{ int slash = name.lastIndexOf('/'); String file = slash >= 0 ? name.substring(slash + 1) : name; InputStream ins = resourceAsStream(baseLoader(), name); if(ins != null) { try { Compiler.load(new InputStreamReader(ins, UTF8), name, file); } finally { ins.close(); } } else if(failIfNotFound) { throw new FileNotFoundException("Could not locate Clojure resource on classpath: " + name); } }
private static final class DefaultComparator implements Comparator, Serializable { public int compare(Object o1, Object o2){ return Util.compare(o1, o2); } private Object readResolve() throws ObjectStreamException { // ensures that we aren't hanging onto a new default comparator for every // sorted set, etc., we deserialize return DEFAULT_COMPARATOR; } }
public Object run(){ try{ Var.pushThreadBindings(RT.map(USE_CONTEXT_CLASSLOADER, RT.T)); // getRootClassLoader(); return new DynamicClassLoader(baseLoader()); } finally{ Var.popThreadBindings(); } } });
String cljfile = scriptbase + ".clj"; String scriptfile = cljfile; URL classURL = getResource(baseLoader(),classfile); URL cljURL = getResource(baseLoader(), scriptfile); if(cljURL == null) { scriptfile = scriptbase + ".cljc"; cljURL = getResource(baseLoader(), scriptfile);