public void scanClass ( InputStream bits ) throws IOException { DataInputStream dstream = new DataInputStream ( new BufferedInputStream ( bits ) ) ; ClassFile cf = null ; try { cf = new ClassFile ( dstream ) ; String className = cf . getName ( ) ; List < String > annotations = new ArrayList < String > ( ) ; accumulateAnnotations ( annotations , ( AnnotationsAttribute ) cf . getAttribute ( AnnotationsAttribute . visibleTag ) ) ; accumulateAnnotations ( annotations , ( AnnotationsAttribute ) cf . getAttribute ( AnnotationsAttribute . invisibleTag ) ) ; // iterate through all valid annotations for ( String validAnn : getValidAnnotations ( ) ) { // check if the current class has one? if ( annotations . contains ( validAnn ) ) { // fire all listeners for ( AnnotationDiscoveryListener listener : getAnnotationDiscoveryListeners ( ) ) { listener . discovered ( className ) ; } } } } finally { dstream . close ( ) ; bits . close ( ) ; } }
Scan class .