(String name)
| 33 | |
| 34 | |
| 35 | protected Class findClass(String name) throws ClassNotFoundException { |
| 36 | try { |
| 37 | InputStream stream = getResourceAsStream(name.replace(".", "/") + ".class"); |
| 38 | if(stream == null) { |
| 39 | throw new ClassNotFoundException("couldn't find class " + name); |
| 40 | } |
| 41 | byte[] buf = new byte[2048]; |
| 42 | ByteArrayOutputStream mem = new ByteArrayOutputStream(); |
| 43 | try { |
| 44 | int size; |
| 45 | while((size = stream.read(buf, 0, buf.length)) > 0) { |
| 46 | mem.write(buf, 0, size); |
| 47 | } |
| 48 | byte[] data = mem.toByteArray(); |
| 49 | return defineClass(name, data, 0, data.length); |
| 50 | } finally { |
| 51 | stream.close(); |
| 52 | } |
| 53 | } catch(IOException e) { |
| 54 | throw new ClassNotFoundException("couldn't find class " + name, e); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | public URL getResource(String path) { |
| 59 | try { |
nothing calls this directly
no test coverage detected