Last active
December 21, 2015 09:29
-
-
Save dushmis/6285690 to your computer and use it in GitHub Desktop.
Custome Class Loader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomeClassLoader_T{ | |
static class CustomClassLoader extends ClassLoader { | |
String host; | |
int port; | |
public Class findClass(String name) { | |
byte[] b = loadClassData(name); | |
return b!=null?defineClass(name, b, 0, b.length):null;//or throw, return null for this example | |
} | |
private byte[] loadClassData(String name) { | |
// load the class data from the connection | |
return null; | |
} | |
} | |
public static void main(String... arg){ | |
Class r = new CustomeClassLoader_T.CustomClassLoader().findClass("com.x.MyClass"); | |
System.out.println(r); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment