Class DecompileProcess


  • public class DecompileProcess
    extends java.lang.Object
    Class for communicating with a single decompiler process. The process controls decompilation for a single Program. The process is initiated by the registerProgram method. If the process is ready, the statusGood flag will be set to true. This flag must be checked via the isReady method prior to invoking any of the public methods. If the process isn't ready, the only way to recover is by reissuing the registerProgram call and making any other necessary initialization calls.
    • Constructor Detail

      • DecompileProcess

        public DecompileProcess​(java.lang.String path)
    • Method Detail

      • dispose

        public void dispose()
      • registerProgram

        public void registerProgram​(DecompileCallback cback,
                                    java.lang.String pspecxml,
                                    java.lang.String cspecxml,
                                    java.lang.String tspecxml,
                                    java.lang.String coretypesxml)
                             throws java.io.IOException,
                                    DecompileException
        Initialize decompiler for a particular platform
        Parameters:
        cback - = callback object for decompiler
        pspecxml - = string containing .pspec xml
        cspecxml - = string containing .cspec xml
        tspecxml - = XML string containing translator spec
        coretypesxml - = XML description of core data-types
        Throws:
        java.io.IOException - for problems with the pipe to the decompiler process
        DecompileException - for problems executing the command
      • deregisterProgram

        public int deregisterProgram()
                              throws java.io.IOException,
                                     DecompileException
        Free decompiler resources
        Returns:
        1 if a program was actively deregistered, 0 otherwise
        Throws:
        java.io.IOException - for problems with the pipe to the decompiler
        DecompileException - for problems executing the command
      • sendCommand

        public LimitedByteBuffer sendCommand​(java.lang.String command)
                                      throws java.io.IOException,
                                             DecompileException
        Send a single command to the decompiler with no parameters and return response
        Parameters:
        command - is the name of the command to execute
        Returns:
        the response String
        Throws:
        java.io.IOException - for any problems with the pipe to the decompiler process
        DecompileException - for any problems executing the command
      • isReady

        public boolean isReady()
      • sendCommand1ParamTimeout

        public LimitedByteBuffer sendCommand1ParamTimeout​(java.lang.String command,
                                                          java.lang.String param,
                                                          int timeoutSecs)
                                                   throws java.io.IOException,
                                                          DecompileException
        Parameters:
        command - the decompiler should execute
        param - an additional parameter for the command
        timeoutSecs - the number of seconds to run before timing out
        Returns:
        the response string
        Throws:
        java.io.IOException - for any problems with the pipe to the decompiler process
        DecompileException - for any problems while executing the command
      • sendCommand2Params

        public LimitedByteBuffer sendCommand2Params​(java.lang.String command,
                                                    java.lang.String param1,
                                                    java.lang.String param2)
                                             throws java.io.IOException,
                                                    DecompileException
        Send a command with 2 parameters to the decompiler and read the result
        Parameters:
        command - string to send
        param1 - is the first parameter string
        param2 - is the second parameter string
        Returns:
        the result string
        Throws:
        java.io.IOException - for any problems with the pipe to the decompiler process
        DecompileException - for problems executing the command
      • setMaxResultSize

        public void setMaxResultSize​(int maxResultSizeMBytes)
      • sendCommand1Param

        public LimitedByteBuffer sendCommand1Param​(java.lang.String command,
                                                   java.lang.String param1)
                                            throws java.io.IOException,
                                                   DecompileException
        Send a command to the decompiler with one parameter and return the result
        Parameters:
        command - is the command string
        param1 - is the parameter as a string
        Returns:
        the result string
        Throws:
        java.io.IOException - for problems with the pipe to the decompiler process
        DecompileException - for problems executing the command