public abstract class OfflineInstrumenterBase extends 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(File baseDirectory,
File f)
Add a class file containing a source class to instrument.
|
void |
addInputDirectory(File baseDirectory,
File d)
Add a directory containing class files to instrument.
|
boolean |
addInputElement(File baseDirectory,
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(File f)
Add a JAR file containing source classes to instrument.
|
void |
addInputJarEntry(File f,
String name)
Add a JAR entry containing a source class to instrument.
|
OutputStream |
addOutputJarEntry(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(InputStream in,
OutputStream out) |
void |
endOutputJarEntry()
Complete and flush the entry initiated by addOutputJarEntry.
|
protected abstract String |
getClassName(Object cl) |
String |
getLastClassResourceName()
Get the name of the resource containing the last class returned.
|
int |
getNumInputClasses() |
File |
getOutputFile()
Returns the File we are storing classes into.
|
protected Object |
internalNextClass() |
protected boolean |
internalOutputModifiedClass(Object cf,
String name,
Object mods) |
protected abstract Object |
makeClassFromStream(String inputName,
BufferedInputStream s) |
String[] |
parseStandardArgs(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(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(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(Object cl,
Object mods,
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(File f)
public final void setPassUnmodifiedClasses(boolean pass)
public final void addInputJar(File f) throws IOException
IOExceptionpublic final void addInputJarEntry(File f, String name)
public final void addInputClass(File baseDirectory, File f)
public final void addInputDirectory(File baseDirectory, File d) throws IOException, IllegalArgumentException
IllegalArgumentException - if d is nullIOExceptionpublic final boolean addInputElement(File baseDirectory, String a) throws IOException
IllegalArgumentException - if a is nullIOExceptionpublic final String[] parseStandardArgs(String[] args) throws IllegalArgumentException, IOException
IllegalArgumentException - if args == nullIOExceptionpublic final int getNumInputClasses()
public final void beginTraversal()
protected abstract Object makeClassFromStream(String inputName, BufferedInputStream s) throws IOException
IOExceptionprotected abstract void writeClassTo(Object cl, Object mods, OutputStream s) throws IOException
IOExceptionprotected final Object internalNextClass() throws IOException
IOExceptionpublic final String getLastClassResourceName()
public final File getOutputFile()
protected final boolean internalOutputModifiedClass(Object cf, String name, Object mods) throws IOException
IOExceptionpublic final void setJARComment(String comment) throws IOException, IllegalStateException
IOExceptionIllegalStateExceptionpublic final void setIgnore()
throws IllegalArgumentException
IllegalArgumentExceptionpublic static void copyStream(InputStream in, OutputStream out) throws IllegalArgumentException, IOException
IllegalArgumentExceptionIOExceptionpublic final OutputStream addOutputJarEntry(ZipEntry ze) throws IOException, IllegalStateException
IOExceptionIllegalStateExceptionpublic final void endOutputJarEntry()
throws IOException,
IllegalStateException
IOExceptionIllegalStateExceptionpublic final void writeUnmodifiedClasses()
throws IOException,
IllegalStateException
IOExceptionIllegalStateExceptionpublic final void close()
throws IOException,
IllegalStateException
IOExceptionIllegalStateExceptionCopyright © 2019. All rights reserved.