org.jacoco.core.instr
Class Analyzer

java.lang.Object
  extended by org.jacoco.core.instr.Analyzer

public class Analyzer
extends Object

Several APIs to analyze class structures.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Constructor Summary
Analyzer(IStructureVisitor structureVisitor)
          Creates a new analyzer reporting to the given output.
 
Method Summary
 void analyze(byte[] buffer)
          Analyzes the class definition from a given in-memory buffer.
 void analyze(ClassReader reader)
          Analyzes the class given as a ASM reader.
 void analyze(File file)
          Analyzes the class definition contained in a given file.
 void analyze(InputStream input)
          Analyzes the class definition from a given input stream.
 void analyzeAll(File directory)
          Analyzes all class files contained in the given directory and its children.
 void analyzeJAR(File jarfile)
          Analyzes all class files contained in a JAR file.
 void analyzeJAR(InputStream input)
          Analyzes all class files contained in a JAR file.
 void analyzePath(String path, File basedir)
          Analyzes all class from the given class path.
 ClassVisitor createAnalyzingVisitor(long classid)
          Creates an ASM class visitor for analysis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Analyzer

public Analyzer(IStructureVisitor structureVisitor)
Creates a new analyzer reporting to the given output.

Parameters:
structureVisitor - the output instance that will receive all structure data
Method Detail

createAnalyzingVisitor

public ClassVisitor createAnalyzingVisitor(long classid)
Creates an ASM class visitor for analysis.

Parameters:
classid - id of the class calculated with CRC64
Returns:
ASM visitor to write class definition to

analyze

public void analyze(ClassReader reader)
Analyzes the class given as a ASM reader.

Parameters:
reader - reader with class definitions

analyze

public void analyze(byte[] buffer)
Analyzes the class definition from a given in-memory buffer.

Parameters:
buffer - class definitions

analyze

public void analyze(InputStream input)
             throws IOException
Analyzes the class definition from a given input stream.

Parameters:
input - stream to read class definition from
Throws:
IOException

analyze

public void analyze(File file)
             throws IOException
Analyzes the class definition contained in a given file.

Parameters:
file - class file
Throws:
IOException

analyzeAll

public void analyzeAll(File directory)
                throws IOException
Analyzes all class files contained in the given directory and its children.

Parameters:
directory - folder to look for class files
Throws:
IOException - thrown if the given file object does not represent a readable directory

analyzeJAR

public void analyzeJAR(InputStream input)
                throws IOException
Analyzes all class files contained in a JAR file.

Parameters:
input - stream to read the JAR file from
Throws:
IOException

analyzeJAR

public void analyzeJAR(File jarfile)
                throws IOException
Analyzes all class files contained in a JAR file.

Parameters:
jarfile - JAR file
Throws:
IOException

analyzePath

public void analyzePath(String path,
                        File basedir)
                 throws IOException
Analyzes all class from the given class path.

Parameters:
path - path definition
basedir - optional base directory, if null the current working directory is used as the base for relative path entries
Throws:
IOException