protected Class<?> defineClass(String name, sun.misc.Resource res) throws IOException {
		final int i = name.lastIndexOf('.');
		final URL url = res.getCodeSourceURL();
		if (i != -1) {
			final String pkgname = name.substring(0, i);
			// Check if package already loaded.
			final Package pkg = getPackage(pkgname);
			final Manifest man = res.getManifest();
			if (pkg != null) {
				// Package found, so check package sealing.
				if (pkg.isSealed()) {
					// Verify that code source URL is the same.
					if (!pkg.isSealed(url)) {
						throw new SecurityException(Locale.getString("E1", pkgname)); //$NON-NLS-1$
					}
				} else {
					// Make sure we are not attempting to seal the package
					// at this code source URL.
					if ((man != null) && isSealed(pkgname, man)) {
						throw new SecurityException(Locale.getString("E2", pkgname)); //$NON-NLS-1$
					}
				}
			} else {
				if (man != null) {
					definePackage(pkgname, man, url);
				} else {
					definePackage(pkgname, null, null, null, null, null, null, null);
				}
			}
		}
		// Now read the class bytes and define the class
		final java.nio.ByteBuffer bb = res.getByteBuffer();
		if (bb != null) {
			// Use (direct) ByteBuffer:
			final CodeSigner[] signers = res.getCodeSigners();
			final CodeSource cs = new CodeSource(url, signers);
			return defineClass(name, bb, cs);
		}

		final byte[] b = res.getBytes();
		// must read certificates AFTER reading bytes.
		final CodeSigner[] signers = res.getCodeSigners();
		final CodeSource cs = new CodeSource(url, signers);
		return defineClass(name, b, 0, b.length, cs);

	}
protected Class < ? > defineClass ( String name , sun . misc . Resource res ) throws IOException { final int i = name . lastIndexOf ( '.' ) ; final URL url = res . getCodeSourceURL ( ) ; if ( i != - 1 ) { final String pkgname = name . substring ( 0 , i ) ; final Package pkg = getPackage ( pkgname ) ; final Manifest man = res . getManifest ( ) ; if ( pkg != null ) { if ( pkg . isSealed ( ) ) { if ( ! pkg . isSealed ( url ) ) { throw new SecurityException ( Locale . getString ( "E1" , pkgname ) ) ; } } else { if ( ( man != null ) && isSealed ( pkgname , man ) ) { throw new SecurityException ( Locale . getString ( "E2" , pkgname ) ) ; } } } else { if ( man != null ) { definePackage ( pkgname , man , url ) ; } else { definePackage ( pkgname , null , null , null , null , null , null , null ) ; } } } final java . nio . ByteBuffer bb = res . getByteBuffer ( ) ; if ( bb != null ) { final CodeSigner [ ] signers = res . getCodeSigners ( ) ; final CodeSource cs = new CodeSource ( url , signers ) ; return defineClass ( name , bb , cs ) ; } final byte [ ] b = res . getBytes ( ) ; final CodeSigner [ ] signers = res . getCodeSigners ( ) ; final CodeSource cs = new CodeSource ( url , signers ) ; return defineClass ( name , b , 0 , b . length , cs ) ; }
Defines a Class using the class bytes obtained from the specified
Resource. The resulting Class must be resolved before it can be
used.

@param name is the name of the class to define
@param res is the resource from which the class byte-code could be obtained
@return the loaded class.
@throws IOException in case the byte-code was unavailable.