org.apache.batik.util
Class ClassFileUtilities

java.lang.Object
  extended by org.apache.batik.util.ClassFileUtilities

public class ClassFileUtilities
extends Object

This class contains utility methods to manipulate Java classes.

Version:
$Id: ClassFileUtilities.java 1733416 2016-03-03 07:07:13Z gadams $
Author:
Stephane Hillion

Nested Class Summary
protected static class ClassFileUtilities.ClassFile
           
protected static class ClassFileUtilities.Jar
           
protected static class ClassFileUtilities.Triple
           
 
Field Summary
static byte CONSTANT_CLASS_INFO
           
static byte CONSTANT_DOUBLE_INFO
           
static byte CONSTANT_FIELDREF_INFO
           
static byte CONSTANT_FLOAT_INFO
           
static byte CONSTANT_INTEGER_INFO
           
static byte CONSTANT_INTERFACEMETHODREF_INFO
           
static byte CONSTANT_LONG_INFO
           
static byte CONSTANT_METHODREF_INFO
           
static byte CONSTANT_NAMEANDTYPE_INFO
           
static byte CONSTANT_STRING_INFO
           
static byte CONSTANT_UTF8_INFO
           
 
Constructor Summary
protected ClassFileUtilities()
          This class does not need to be instantiated.
 
Method Summary
static Set getClassDependencies(InputStream is)
          Returns the dependencies of the given class.
static Set getClassDependencies(InputStream is, Set classpath, boolean rec)
           
static Set getClassDependencies(String path, Set classpath, boolean rec)
          Returns the dependencies of the given class.
protected static Set getDescriptorClasses(String desc)
          Returns the classes contained in a field or method desciptor.
static void main(String[] args)
          Program that computes the dependencies between the Batik jars.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT_UTF8_INFO

public static final byte CONSTANT_UTF8_INFO
See Also:
Constant Field Values

CONSTANT_INTEGER_INFO

public static final byte CONSTANT_INTEGER_INFO
See Also:
Constant Field Values

CONSTANT_FLOAT_INFO

public static final byte CONSTANT_FLOAT_INFO
See Also:
Constant Field Values

CONSTANT_LONG_INFO

public static final byte CONSTANT_LONG_INFO
See Also:
Constant Field Values

CONSTANT_DOUBLE_INFO

public static final byte CONSTANT_DOUBLE_INFO
See Also:
Constant Field Values

CONSTANT_CLASS_INFO

public static final byte CONSTANT_CLASS_INFO
See Also:
Constant Field Values

CONSTANT_STRING_INFO

public static final byte CONSTANT_STRING_INFO
See Also:
Constant Field Values

CONSTANT_FIELDREF_INFO

public static final byte CONSTANT_FIELDREF_INFO
See Also:
Constant Field Values

CONSTANT_METHODREF_INFO

public static final byte CONSTANT_METHODREF_INFO
See Also:
Constant Field Values

CONSTANT_INTERFACEMETHODREF_INFO

public static final byte CONSTANT_INTERFACEMETHODREF_INFO
See Also:
Constant Field Values

CONSTANT_NAMEANDTYPE_INFO

public static final byte CONSTANT_NAMEANDTYPE_INFO
See Also:
Constant Field Values
Constructor Detail

ClassFileUtilities

protected ClassFileUtilities()
This class does not need to be instantiated.

Method Detail

main

public static void main(String[] args)
Program that computes the dependencies between the Batik jars.

Run this from the main Batik distribution directory, after building the jars. For every jar file in the batik-xxx/ build directory, it will determine which other jar files it directly depends on. The output is lines of the form:

  number,from,to

where mean that the from jar has number class files that depend on class files in the to jar.


getClassDependencies

public static Set getClassDependencies(String path,
                                       Set classpath,
                                       boolean rec)
                                throws IOException
Returns the dependencies of the given class.

Parameters:
path - The root class path.
classpath - The set of directories (Strings) to scan.
rec - Whether to follow dependencies recursively.
Returns:
a list of paths representing the used classes.
Throws:
IOException

getClassDependencies

public static Set getClassDependencies(InputStream is,
                                       Set classpath,
                                       boolean rec)
                                throws IOException
Throws:
IOException

getClassDependencies

public static Set getClassDependencies(InputStream is)
                                throws IOException
Returns the dependencies of the given class.

Returns:
a list of strings representing the used classes.
Throws:
IOException

getDescriptorClasses

protected static Set getDescriptorClasses(String desc)
Returns the classes contained in a field or method desciptor.



Copyright © 2000–2017 Apache Software Foundation. All rights reserved.