Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.decompiler
Class Decompiler

java.lang.Object
  extended bynet.sf.jode.decompiler.Decompiler

public class Decompiler
extends java.lang.Object

This is the interface that other java classes may use to decompile classes. Feel free to use it in your own GNU GPL'ed project. Please tell me about your project.
Note that the GNU GPL doesn't allow you to use this interface in commercial programs.

Version:
1.0
Author:
Jochen Hoenicke

Field Summary
static char altPathSeparatorChar
          We need a different pathSeparatorChar, since ':' (used for most UNIX System) is used a protocol separator in URLs.
 
Constructor Summary
Decompiler()
          Create a new decompiler.
 
Method Summary
 void decompile(java.lang.String className, java.io.Writer writer, ProgressListener progress)
          Decompile a class.
 void setClassPath(ClassPath classpath)
          Set the class path.
 void setClassPath(java.lang.String classpath)
          Sets the class path.
 void setClassPath(java.lang.String[] classpath)
          Set the class path.
 void setErr(java.io.PrintWriter errorStream)
          Set the stream where copyright and warnings/errors are printed to.
 void setOption(java.lang.String option, java.lang.String value)
          Set an option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

altPathSeparatorChar

public static final char altPathSeparatorChar
We need a different pathSeparatorChar, since ':' (used for most UNIX System) is used a protocol separator in URLs. We currently allow both pathSeparatorChar and altPathSeparatorChar and decide if it is a protocol separator by context.

See Also:
Constant Field Values
Constructor Detail

Decompiler

public Decompiler()
Create a new decompiler. Normally you need only one, but you can have more around, with different options and different class paths.

Method Detail

setClassPath

public void setClassPath(java.lang.String classpath)
Sets the class path. Should be called once before decompile is called, otherwise the system class path is used.

Parameters:
classpath - A comma separated classpath.
Throws:
java.lang.NullPointerException - if classpath is null.
See Also:
setClassPath(String[])

setClassPath

public void setClassPath(java.lang.String[] classpath)
Set the class path. Should be called once before decompile is called, otherwise the system class path is used.

Parameters:
classpath - a non empty array of jar files and directories; URLs are allowed, too.
Throws:
java.lang.NullPointerException - if classpath is null.
java.lang.IndexOutOfBoundsException - if classpath array is empty.
See Also:
setClassPath(String)

setClassPath

public void setClassPath(ClassPath classpath)
Set the class path. Should be called once before decompile is called, otherwise the system class path is used.

Parameters:
classpath - a classpath object.
Throws:
java.lang.NullPointerException - if classpath is null.
java.lang.IndexOutOfBoundsException - if classpath array is empty.
See Also:
setClassPath(String)

setOption

public void setOption(java.lang.String option,
                      java.lang.String value)
Set an option.

Parameters:
option - the option (pretty, style, decrypt, verify, etc.)
value - ("1"/"0" for on/off, "sun"/"gnu" for style)
Throws:
java.lang.IllegalArgumentException - if option or value is invalid.

setErr

public void setErr(java.io.PrintWriter errorStream)
Set the stream where copyright and warnings/errors are printed to.

Parameters:
errorStream - the error stream. Note that this is a PrintWriter, not a PrintStream (which are deprecated since 1.1).

decompile

public void decompile(java.lang.String className,
                      java.io.Writer writer,
                      ProgressListener progress)
               throws java.io.IOException
Decompile a class.

Parameters:
className - full-qualified classname, dot separated, e.g. "java.lang.Object"
writer - The stream where the decompiled code should be written. Hint: Use a BufferedWriter for good performance.
progress - A progress listener (see below). Null if you don't need information about progress.
Throws:
java.lang.IllegalArgumentException - if className isn't correct.
IOException - if writer throws an exception.
java.lang.RuntimeException - If jode has a bug ;-)

Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.