Class OfflineInstrumenter


  • public final class OfflineInstrumenter
    extends OfflineInstrumenterBase
    This class provides a convenient way to iterate through a collection of Java classes and instrument their code. This is just a specialization of OfflineInstrumenterBase to use the shrikeCT functionality.
    • Constructor Detail

      • OfflineInstrumenter

        public OfflineInstrumenter()
    • Method Detail

      • makeClassFromStream

        protected java.lang.Object makeClassFromStream​(java.lang.String inputName,
                                                       java.io.BufferedInputStream s)
                                                throws java.io.IOException
        Specified by:
        makeClassFromStream in class OfflineInstrumenterBase
        Throws:
        java.io.IOException
      • writeClassTo

        protected void writeClassTo​(java.lang.Object cl,
                                    java.lang.Object mods,
                                    java.io.OutputStream s)
                             throws java.io.IOException
        Specified by:
        writeClassTo in class OfflineInstrumenterBase
        Throws:
        java.io.IOException
      • nextClass

        public ClassInstrumenter nextClass()
                                    throws java.io.IOException
        Get the next class to be instrumented.
        Throws:
        java.io.IOException
      • outputModifiedClass

        public void outputModifiedClass​(ClassInstrumenter out,
                                        ClassWriter code)
                                 throws java.lang.IllegalStateException,
                                        java.io.IOException
        Update the original class with some method changes. 'code' should be the result of out.emitClass(). You can add new fields and methods to 'code' (or make other changes) before calling this method.
        Throws:
        java.lang.IllegalStateException
        java.io.IOException
      • outputModifiedClass

        public void outputModifiedClass​(ClassInstrumenter out)
                                 throws java.lang.IllegalArgumentException,
                                        java.io.IOException
        Update the original class with some method changes. This method calls out.emitClass() for you.
        Throws:
        java.lang.IllegalArgumentException
        java.io.IOException