/[classpath]/classpath/java/lang/ClassLoader.java
ViewVC logotype

Diff of /classpath/java/lang/ClassLoader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.57 by tromey, Tue Sep 13 21:25:11 2005 UTC revision 1.58 by gnu_andrew, Wed Sep 21 22:35:32 2005 UTC
# Line 49  import java.io.InputStream; Line 49  import java.io.InputStream;
49  import java.lang.reflect.Constructor;  import java.lang.reflect.Constructor;
50  import java.net.URL;  import java.net.URL;
51  import java.net.URLClassLoader;  import java.net.URLClassLoader;
52    import java.nio.ByteBuffer;
53  import java.security.CodeSource;  import java.security.CodeSource;
54  import java.security.PermissionCollection;  import java.security.PermissionCollection;
55  import java.security.Policy;  import java.security.Policy;
# Line 472  public abstract class ClassLoader Line 473  public abstract class ClassLoader
473    }    }
474    
475    /**    /**
476       * Helper to define a class using the contents of a byte buffer. If
477       * the domain is null, the default of
478       * <code>Policy.getPolicy().getPermissions(new CodeSource(null,
479       * null))</code> is used. Once a class has been defined in a
480       * package, all further classes in that package must have the same
481       * set of certificates or a SecurityException is thrown.
482       *
483       * @param name the name to give the class.  null if unknown
484       * @param buf a byte buffer containing bytes that form a class.
485       * @param domain the ProtectionDomain to give to the class, null for the
486       *        default protection domain
487       * @return the class that was defined
488       * @throws ClassFormatError if data is not in proper classfile format
489       * @throws NoClassDefFoundError if the supplied name is not the same as
490       *                              the one specified by the byte buffer.
491       * @throws SecurityException if name starts with "java.", or if certificates
492       *         do not match up
493       * @since 1.5
494       */
495      protected final Class defineClass(String name, ByteBuffer buf,
496                                        ProtectionDomain domain)
497        throws ClassFormatError
498      {
499        byte[] data = new byte[buf.remaining()];
500        buf.get(data);
501        return defineClass(name, data, 0, data.length, domain);
502      }
503    
504      /**
505     * Links the class, if that has not already been done. Linking basically     * Links the class, if that has not already been done. Linking basically
506     * resolves all references to other classes made by this class.     * resolves all references to other classes made by this class.
507     *     *

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26