³×Æ®¿÷À¸·ÎºÎÅÍ Å¬·¡½º ·ÎµåÇϱâ


[ Follow Ups ] [ Post Followup ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

Posted by À±°æ±¸ on July 05, 1997 at 19:03:41:

In Reply to: [Áú¹®] networkÀÇ host¿¡ ÀÖ´Â class ¸¦ local ÀÇ ÀÚ¹Ù ¼Ò½º¿¡¼­ ÀÌ¿ëÇÏ·Á¸é? posted by °­½Åµ¿ on July 04, 1997 at 14:52:56:

ÀÚ¹Ù API ¹®¼­¿¡¼­
java.lang.ClassLoader¸¦ ã¾Æº¸¼¼¿ä. ´ÙÀ½ ¿¹Á¦°¡ ÀÖ½À´Ï´Ù.

For example, an application could create a network class loader to download class files from a server.
Sample code might look like: 

ClassLoader loader¡¡= new NetworkClassLoader(host,¡¡port); Object main¡¡= loader.loadClass("Main", true).newInstance(); ¡¡.¡¡.¡¡.

The network class loader subclass must define the method loadClass to load a class from the network. Once it has downloaded the bytes that make up the class, it should use the method defineClass to create a class instance. A sample implementation is:

class NetworkClassLoader { String host; int port; Hashtable cache = new Hashtable(); private byte loadClassData(String name)[] { // load the class data from the connection ¡¡.¡¡.¡¡. } public synchronized Class loadClass(String name, boolean resolve) { Class c = cache.get(name); if (c == null) { byte data[] = loadClassData(name); c = defineClass(data, 0, data.length); cache.put(name, c); } if (resolve) resolveClass(c); return c; } }

Á¶±Ý¸¸ ¼öÁ¤Çϸé À¥ ¼­ºñ½º¸¦ ÅëÇؼ­ Ŭ·¡½º¸¦ ·ÎµåÇÒ ¼ö ÀÖÀ» °Í °°³×¿ä.
¹°·Ð ´Ù¸¥ È£½ºÆ® Á¢¼ÓÀÌ ÇÊ¿äÇϹǷΠ¾ÖÇø´¿¡¼­´Â »ç¿ëÇÏÁö ¸øÇÏ°ÚÁÒ.


Follow Ups:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ Follow Ups ] [ Post Followup ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]