public abstract class OfflineInstrumenterBase
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
OfflineInstrumenterBase.ManifestBuilder
Thiscallback is notified whenever an entry has been added to the output zip file.
|
| Modifier and Type | Field and Description |
|---|---|
protected ClassHierarchyProvider |
cha |
| Modifier | Constructor and Description |
|---|---|
protected |
OfflineInstrumenterBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
addInputClass(java.io.File baseDirectory,
java.io.File f)
Add a class file containing a source class to instrument.
|
void |
addInputDirectory(java.io.File baseDirectory,
java.io.File d)
Add a directory containing class files to instrument.
|
boolean |
addInputElement(java.io.File baseDirectory,
java.lang.String a)
Add something to instrument --- the name of a JAR file, a class file, a directory or an entry
within a jar file (as filename#entryname).
|
void |
addInputJar(java.io.File f)
Add a JAR file containing source classes to instrument.
|
void |
addInputJarEntry(java.io.File f,
java.lang.String name)
Add a JAR entry containing a source class to instrument.
|
java.io.OutputStream |
addOutputJarEntry(java.util.zip.ZipEntry ze)
Add a raw ZipEntry to the output JAR.
|
void |
beginTraversal()
Start traversing the source class list from the beginning.
|
void |
close()
Call this when you're done modifying classes.
|
static void |
copyStream(java.io.InputStream in,
java.io.OutputStream out) |
void |
endOutputJarEntry()
Complete and flush the entry initiated by addOutputJarEntry.
|
protected abstract java.lang.String |
getClassName(java.lang.Object cl) |
java.lang.String |
getLastClassResourceName()
Get the name of the resource containing the last class returned.
|
int |
getNumInputClasses() |
java.io.File |
getOutputFile()
Returns the File we are storing classes into.
|
protected java.lang.Object |
internalNextClass() |
protected boolean |
internalOutputModifiedClass(java.lang.Object cf,
java.lang.String name,
java.lang.Object mods) |
protected abstract java.lang.Object |
makeClassFromStream(java.lang.String inputName,
java.io.BufferedInputStream s) |
java.lang.String[] |
parseStandardArgs(java.lang.String[] args)
Parse an argument list to find elements to instrument and the name of the output file.
|
void |
setClassHierarchyProvider(ClassHierarchyProvider cha) |
void |
setIgnore()
Skip the last class returned in every future traversal of the class list.
|
void |
setJARComment(java.lang.String comment)
Set the JAR Comment for the output JAR.
|
void |
setManifestBuilder(OfflineInstrumenterBase.ManifestBuilder mb)
This installs a ManifestBuilder callback that this class will notify whenever an entry has been
added to the output zip file.
|
void |
setOutputJar(java.io.File f)
Set the file in which instrumented classes will be deposited.
|
void |
setPassUnmodifiedClasses(boolean pass)
Indicate whether classes which are not modified will be put into the output jar anyway.
|
protected abstract void |
writeClassTo(java.lang.Object cl,
java.lang.Object mods,
java.io.OutputStream s) |
void |
writeUnmodifiedClasses()
Call this to copy any unmodified classes to the output.
|
protected ClassHierarchyProvider cha
public void setManifestBuilder(OfflineInstrumenterBase.ManifestBuilder mb)
public void setClassHierarchyProvider(ClassHierarchyProvider cha)
public final void setOutputJar(java.io.File f)
public final void setPassUnmodifiedClasses(boolean pass)
public final void addInputJar(java.io.File f)
throws java.io.IOException
java.io.IOExceptionpublic final void addInputJarEntry(java.io.File f,
java.lang.String name)
public final void addInputClass(java.io.File baseDirectory,
java.io.File f)
public final void addInputDirectory(java.io.File baseDirectory,
java.io.File d)
throws java.io.IOException,
java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if d is nulljava.io.IOExceptionpublic final boolean addInputElement(java.io.File baseDirectory,
java.lang.String a)
throws java.io.IOException
java.lang.IllegalArgumentException - if a is nulljava.io.IOExceptionpublic final java.lang.String[] parseStandardArgs(java.lang.String[] args)
throws java.lang.IllegalArgumentException,
java.io.IOException
java.lang.IllegalArgumentException - if args == nulljava.io.IOExceptionpublic final int getNumInputClasses()
public final void beginTraversal()
protected abstract java.lang.Object makeClassFromStream(java.lang.String inputName,
java.io.BufferedInputStream s)
throws java.io.IOException
java.io.IOExceptionprotected abstract java.lang.String getClassName(java.lang.Object cl)
protected abstract void writeClassTo(java.lang.Object cl,
java.lang.Object mods,
java.io.OutputStream s)
throws java.io.IOException
java.io.IOExceptionprotected final java.lang.Object internalNextClass()
throws java.io.IOException
java.io.IOExceptionpublic final java.lang.String getLastClassResourceName()
public final java.io.File getOutputFile()
protected final boolean internalOutputModifiedClass(java.lang.Object cf,
java.lang.String name,
java.lang.Object mods)
throws java.io.IOException
java.io.IOExceptionpublic final void setJARComment(java.lang.String comment)
throws java.io.IOException,
java.lang.IllegalStateException
java.io.IOExceptionjava.lang.IllegalStateExceptionpublic final void setIgnore()
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static void copyStream(java.io.InputStream in,
java.io.OutputStream out)
throws java.lang.IllegalArgumentException,
java.io.IOException
java.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic final java.io.OutputStream addOutputJarEntry(java.util.zip.ZipEntry ze)
throws java.io.IOException,
java.lang.IllegalStateException
java.io.IOExceptionjava.lang.IllegalStateExceptionpublic final void endOutputJarEntry()
throws java.io.IOException,
java.lang.IllegalStateException
java.io.IOExceptionjava.lang.IllegalStateExceptionpublic final void writeUnmodifiedClasses()
throws java.io.IOException,
java.lang.IllegalStateException
java.io.IOExceptionjava.lang.IllegalStateExceptionpublic final void close()
throws java.io.IOException,
java.lang.IllegalStateException
java.io.IOExceptionjava.lang.IllegalStateException