Class ClassFileUtilities

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

public class ClassFileUtilities extends Object
This class contains utility methods to manipulate Java classes.
Version:
$Id: ClassFileUtilities.java 1804130 2017-08-04 14:41:11Z ssteiner $
  • Field Details

  • Constructor Details

    • ClassFileUtilities

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

    • 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.

    • collectJars

      private static void collectJars(File dir, Map jars, Map classFiles) throws IOException
      Throws:
      IOException
    • 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
    • computeClassDependencies

      private static void computeClassDependencies(InputStream is, Set classpath, Set done, Set result, 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.