private void readBasicClassInfo ( ) throws IOException , ClassfileFormatException , SkipClassException { // Modifier flags classModifiers = inputStreamOrByteBuffer . readUnsignedShort ( ) ; isInterface = ( classModifiers & 0x0200 ) != 0 ; isAnnotation = ( classModifiers & 0x2000 ) != 0 ; // The fully-qualified class name of this class, with slashes replaced with dots final String classNamePath = getConstantPoolString ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; if ( classNamePath == null ) { throw new ClassfileFormatException ( "Class name is null" ) ; } className = classNamePath . replace ( ' ' , ' ' ) ; if ( "java.lang.Object" . equals ( className ) ) { // Don't process java.lang.Object (it has a null superclass), though you can still search for classes // that are subclasses of java.lang.Object (as an external class). throw new SkipClassException ( "No need to scan java.lang.Object" ) ; } // Check class visibility modifiers final boolean isModule = ( classModifiers & 0x8000 ) != 0 ; // Equivalently filename is "module-info.class" final boolean isPackage = relativePath . regionMatches ( relativePath . lastIndexOf ( ' ' ) + 1 , "package-info.class" , 0 , 18 ) ; if ( ! scanSpec . ignoreClassVisibility && ! Modifier . isPublic ( classModifiers ) && ! isModule && ! isPackage ) { throw new SkipClassException ( "Class is not public, and ignoreClassVisibility() was not called" ) ; } // Make sure classname matches relative path if ( ! relativePath . endsWith ( ".class" ) ) { // Should not happen throw new SkipClassException ( "Classfile filename " + relativePath + " does not end in \".class\"" ) ; } final int len = classNamePath . length ( ) ; if ( relativePath . length ( ) != len + 6 || ! classNamePath . regionMatches ( 0 , relativePath , 0 , len ) ) { throw new SkipClassException ( "Relative path " + relativePath + " does not match class name " + className ) ; } // Superclass name, with slashes replaced with dots final int superclassNameCpIdx = inputStreamOrByteBuffer . readUnsignedShort ( ) ; if ( superclassNameCpIdx > 0 ) { superclassName = getConstantPoolClassName ( superclassNameCpIdx ) ; } }
Read basic class information .