Class Class2HTML

  • All Implemented Interfaces:
    Constants

    public class Class2HTML
    extends java.lang.Object
    implements Constants
    Read class file(s) and convert them into HTML files. Given a JavaClass object "class" that is in package "package" five files will be created in the specified directory.
    1. "package"."class".html as the main file which defines the frames for the following subfiles.
    2. "package"."class"_attributes.html contains all (known) attributes found in the file
    3. "package"."class"_cp.html contains the constant pool
    4. "package"."class"_code.html contains the byte code
    5. "package"."class"_methods.html contains references to all methods and fields of the class
    All subfiles reference each other appropriately, e.g. clicking on a method in the Method's frame will jump to the appropriate method in the Code frame.
    • Field Detail

      • classPackage

        private static java.lang.String classPackage
      • className

        private static java.lang.String className
      • basicTypes

        private static final java.util.Set<java.lang.String> basicTypes
      • javaClass

        private final JavaClass javaClass
      • dir

        private final java.lang.String dir
    • Constructor Detail

      • Class2HTML

        public Class2HTML​(JavaClass javaClass,
                          java.lang.String dir)
                   throws java.io.IOException
        Write contents of the given JavaClass into HTML files.
        Parameters:
        javaClass - The class to write
        dir - The directory to put the files in
        Throws:
        java.io.IOException - Thrown when an I/O exception of some sort has occurred.
      • Class2HTML

        private Class2HTML​(JavaClass javaClass,
                           java.lang.String dir,
                           java.nio.charset.Charset charset)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • main

        public static void main​(java.lang.String[] argv)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • referenceClass

        static java.lang.String referenceClass​(int index)
        Utility method that converts a class reference in the constant pool, i.e., an index to a string.
      • referenceType

        static java.lang.String referenceType​(java.lang.String type)
      • toHTML

        static java.lang.String toHTML​(java.lang.String str)
      • writeMainHTML

        private void writeMainHTML​(AttributeHTML attributeHtml,
                                   java.nio.charset.Charset charset)
                            throws java.io.FileNotFoundException,
                                   java.io.UnsupportedEncodingException
        Throws:
        java.io.FileNotFoundException
        java.io.UnsupportedEncodingException