// TODO: inner classes will not be found (need to replace . with $) static InputStream inputStreamForClass(Class c) ctex { if (c == null) null; ClassLoader cl = getClassLoader(c); // handle JavaXClassLoader L files = cast getOpt(cl, 'files); if (files != null) { S name = c.getName().replace('.', '/') + ".class"; for (File location : files) if (location.isDirectory()) { File f = new File(location, name); if (f.exists()) ret new FileInputStream(f); } else if (location.isFile()) pcall { InputStream in = zipFileInputStream(location, name); if (in != null) ret in; } fail(name + " not found in: " + files); } ifdef Jython // for patched Jython class loader if (classNameIs(cl, "org.python.core.BytecodeLoader$Loader")) { Map rawData = cast getOpt(cl, "rawData"); ret byteArrayInputStreamOrNull(mapGet(rawData, c.getName())); } endifdef ret null; }