protected final Class<?> defineClass(String className,byte[] classRep,int offset,int length,ProtectionDomain protectionDomain) throws java.lang.ClassFormatError {
  if (className != null && className.indexOf('/') != -1) {
    throw new NoClassDefFoundError("The name is expected in binary (canonical) form," + " therefore '/' symbols are not allowed: " + className);
  }
  if (offset < 0 || length < 0 || offset + length > classRep.length) {
    throw new IndexOutOfBoundsException("Either offset or len is outside of the data array");
  }
  if (protectionDomain == null) {
    if (defaultDomain == null) {
      defaultDomain=new ProtectionDomain(new CodeSource(null,(Certificate[])null),null,this,null);
    }
    protectionDomain=defaultDomain;
  }
  Certificate[] certs=null;
  String packageName=null;
  if (className != null) {
    if (className.startsWith("java.")) {
      throw new SecurityException("It is not allowed to define classes inside the java.* package: " + className);
    }
    int lastDot=className.lastIndexOf('.');
    packageName=lastDot == -1 ? "" : className.substring(0,lastDot);
    certs=getCertificates(packageName,protectionDomain.getCodeSource());
  }
  Class<?> clazz=defineClass0(className,classRep,offset,length);
  clazz.setProtectionDomain(protectionDomain);
  if (certs != null) {
    packageCertificates.put(packageName,certs);
  }
  return clazz;
}

protected final Class < ? > defineClass ( String className , byte [ ] classRep , int offset , int length , ProtectionDomain protectionDomain ) throws java . lang . ClassFormatError { if ( className != null && className . indexOf ( '/' ) != - 1 ) { throw new NoClassDefFoundError ( "The name is expected in binary (canonical) form," + " therefore '/' symbols are not allowed: " + className ) ; } if ( offset < 0 || length < 0 || offset + length > classRep . length ) { throw new IndexOutOfBoundsException ( "Either offset or len is outside of the data array" ) ; } if ( protectionDomain == null ) { if ( defaultDomain == null ) { defaultDomain = new ProtectionDomain ( new CodeSource ( null , ( Certificate [ ] ) null ) , null , this , null ) ; } protectionDomain = defaultDomain ; } Certificate [ ] certs = null ; String packageName = null ; if ( className != null ) { if ( className . startsWith ( "java." ) ) { throw new SecurityException ( "It is not allowed to define classes inside the java.* package: " + className ) ; } int lastDot = className . lastIndexOf ( '.' ) ; packageName = lastDot == - 1 ? "" : className . substring ( 0 , lastDot ) ; certs = getCertificates ( packageName , protectionDomain . getCodeSource ( ) ) ; } Class < ? > clazz = defineClass0 ( className , classRep , offset , length ) ; clazz . setProtectionDomain ( protectionDomain ) ; if ( certs != null ) { packageCertificates . put ( packageName , certs ) ; } return clazz ; }
constructs a new class from an array of bytes containing a class definition in class file format and assigns the new class to the specified protection domain .
