org.jacoco.core.instr
Class Instrumenter

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

public class Instrumenter
extends Object

Several APIs to instrument Java class definitions for coverage tracing.


Constructor Summary
Instrumenter(IExecutionDataAccessorGenerator runtime)
          Creates a new instance based on the given runtime.
 
Method Summary
 byte[] instrument(byte[] buffer)
          Creates a instrumented version of the given class if possible.
 byte[] instrument(org.objectweb.asm.ClassReader reader)
          Creates a instrumented version of the given class if possible.
 byte[] instrument(InputStream input)
          Creates a instrumented version of the given class if possible.
 void instrument(InputStream input, OutputStream output)
          Creates a instrumented version of the given class file.
 int instrumentAll(InputStream input, OutputStream output)
          Creates a instrumented version of the given resource depending on its type.
 int instrumentArchive(InputStream input, OutputStream output)
          Creates a instrumented version of the given archive, i.e. with all class files contained in this archive instrumented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Instrumenter

public Instrumenter(IExecutionDataAccessorGenerator runtime)
Creates a new instance based on the given runtime.

Parameters:
runtime - runtime used by the instrumented classes
Method Detail

instrument

public byte[] instrument(org.objectweb.asm.ClassReader reader)
Creates a instrumented version of the given class if possible.

Parameters:
reader - definition of the class as ASM reader
Returns:
instrumented definition

instrument

public byte[] instrument(byte[] buffer)
Creates a instrumented version of the given class if possible.

Parameters:
buffer - definition of the class
Returns:
instrumented definition

instrument

public byte[] instrument(InputStream input)
                  throws IOException
Creates a instrumented version of the given class if possible.

Parameters:
input - stream to read class definition from
Returns:
instrumented definition
Throws:
IOException - if reading data from the stream fails

instrument

public void instrument(InputStream input,
                       OutputStream output)
                throws IOException
Creates a instrumented version of the given class file.

Parameters:
input - stream to read class definition from
output - stream to write the instrumented version of the class to
Throws:
IOException - if reading data from the stream fails

instrumentArchive

public int instrumentArchive(InputStream input,
                             OutputStream output)
                      throws IOException
Creates a instrumented version of the given archive, i.e. with all class files contained in this archive instrumented. Contained resources which are no class files or archive files are copied as is.

Parameters:
input - stream to read archive from
output - stream to write the instrumented version of the class to
Returns:
number of instrumented classes
Throws:
IOException - if reading data from the stream fails

instrumentAll

public int instrumentAll(InputStream input,
                         OutputStream output)
                  throws IOException
Creates a instrumented version of the given resource depending on its type. Class files and the content of archive files are instrumented. All other files are copied without modification.

Parameters:
input - stream to contents from
output - stream to write the instrumented version of the contents
Returns:
number of instrumented classes
Throws:
IOException - if reading data from the stream fails


Copyright © 2009-2013 Mountainminds GmbH & Co. KG. All Rights Reserved.