Class GuardDB

  • All Implemented Interfaces:
    ClassConstants

    public class GuardDB
    extends java.lang.Object
    implements ClassConstants
    Classfile database for obfuscation.
    • Constructor Detail

      • GuardDB

        public GuardDB​(java.io.File[] inFile)
                throws java.io.IOException
        A classfile database for obfuscation.
        Parameters:
        inFile - the in file
        Throws:
        java.io.IOException - the io exception
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.io.IOException
        Close input JAR file and log-file at GC-time.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.io.IOException
      • setResourceHandler

        public void setResourceHandler​(ResourceHandler handler)
        Sets resource handler.
        Parameters:
        handler - the handler
      • getOutName

        public java.lang.String getOutName​(java.lang.String inName)
        Gets out name.
        Parameters:
        inName - the in name
        Returns:
        the out name
      • retain

        public void retain​(java.util.Collection rgsEntries,
                           java.io.PrintWriter log)
                    throws java.io.IOException
        Go through database marking certain entities for retention, while maintaining polymorphic integrity.
        Parameters:
        rgsEntries - the rgs entries
        log - the log
        Throws:
        java.io.IOException - the io exception
      • remapTo

        public void remapTo​(java.io.File[] out,
                            Filter fileFilter,
                            java.io.PrintWriter log,
                            boolean conserveManifest)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
        Remap each class based on the remap database, and remove attributes.
        Parameters:
        out - the out
        fileFilter - the file filter
        log - the log
        conserveManifest - the conserve manifest
        Throws:
        java.io.IOException - the io exception
        java.lang.ClassNotFoundException - the class not found exception
      • close

        public void close()
                   throws java.io.IOException
        Close input JAR file. @throws IOException the io exception
        Throws:
        java.io.IOException - the io exception
      • fireParsingJar

        protected void fireParsingJar​(java.lang.String jar)
        Fire parsing jar.
        Parameters:
        jar - the jar
      • fireParsingClass

        protected void fireParsingClass​(java.lang.String className)
        Fire parsing class.
        Parameters:
        className - the class name
      • fireObfuscatingJar

        protected void fireObfuscatingJar​(java.lang.String inJar,
                                          java.lang.String outJar)
        Fire obfuscating jar.
        Parameters:
        inJar - the in jar
        outJar - the out jar
      • fireObfuscatingClass

        protected void fireObfuscatingClass​(java.lang.String className)
        Fire obfuscating class.
        Parameters:
        className - the class name
      • addListener

        public void addListener​(ObfuscationListener listener)
        Registers Listener to receive events.
        Parameters:
        listener - The listener to register.
      • removeListener

        public void removeListener​(ObfuscationListener listener)
        Removes Listener from the list of listeners.
        Parameters:
        listener - The listener to remove.
      • isReplaceClassNameStrings

        public boolean isReplaceClassNameStrings()
        Getter for property replaceClassNameStrings.
        Returns:
        Value of property replaceClassNameStrings.
      • setReplaceClassNameStrings

        public void setReplaceClassNameStrings​(boolean replaceClassNameStrings)
        Setter for property replaceClassNameStrings.
        Parameters:
        replaceClassNameStrings - New value of property replaceClassNameStrings.
      • isPedantic

        public boolean isPedantic()
        Getter for property pedantic.
        Returns:
        Value of property pedantic.
      • setPedantic

        public void setPedantic​(boolean pedantic)
        Setter for property pedantic.
        Parameters:
        pedantic - New value of property pedantic.
      • translateJavaFile

        public java.lang.String translateJavaFile​(java.lang.String javaClass)
        Returns the obfuscated file name of the java class. The ending ".class" is omitted.
        Parameters:
        javaClass - the fully qualified name of an unobfuscated class.
        Returns:
        the string
      • translateJavaClass

        public java.lang.String translateJavaClass​(java.lang.String javaClass)
        Translate java class string.
        Parameters:
        javaClass - the java class
        Returns:
        the string
      • translateItem

        public java.lang.String translateItem​(java.lang.String identifier,
                                              char seperator,
                                              boolean strict)
        Translates the given class or package identifier.
        Parameters:
        identifier - a qualified class name or a jar entry name.
        strict - if true, translate the whole identifier only; otherwise translate as much of the given identifier as possible.
        Returns:
        the mapped identifier.
      • setDigests

        public void setDigests​(java.lang.String[] digestStrings)
        Sets digests.
        Parameters:
        digestStrings - the digest strings
      • setAnnotationClass

        public void setAnnotationClass​(java.lang.String annotationClass)
        Sets annotation class.
        Parameters:
        annotationClass - the annotation class