(String internalName, byte[] bytecode)
| 8244 | } |
| 8245 | |
| 8246 | static public void writeClassFile(String internalName, byte[] bytecode) throws IOException{ |
| 8247 | String genPath = (String) COMPILE_PATH.deref(); |
| 8248 | if(genPath == null) |
| 8249 | throw Util.runtimeException("*compile-path* not set"); |
| 8250 | String[] dirs = internalName.split("/"); |
| 8251 | String p = genPath; |
| 8252 | for(int i = 0; i < dirs.length - 1; i++) |
| 8253 | { |
| 8254 | p += File.separator + dirs[i]; |
| 8255 | (new File(p)).mkdir(); |
| 8256 | } |
| 8257 | String path = genPath + File.separator + internalName + ".class"; |
| 8258 | File cf = new File(path); |
| 8259 | cf.createNewFile(); |
| 8260 | FileOutputStream cfs = new FileOutputStream(cf); |
| 8261 | try |
| 8262 | { |
| 8263 | cfs.write(bytecode); |
| 8264 | cfs.flush(); |
| 8265 | } |
| 8266 | finally |
| 8267 | { |
| 8268 | cfs.close(); |
| 8269 | } |
| 8270 | } |
| 8271 | |
| 8272 | public static void pushNS(){ |
| 8273 | Var.pushThreadBindings(PersistentHashMap.create(Var.intern(Symbol.intern("clojure.core"), |
no test coverage detected