Class CommandlineImpl

  • All Implemented Interfaces:
    Commandline

    public class CommandlineImpl
    extends java.lang.Object
    implements Commandline
    • Field Detail

      • mTimeout

        private long mTimeout
      • mLogEnabled

        private boolean mLogEnabled
    • Constructor Detail

      • CommandlineImpl

        public CommandlineImpl()
      • CommandlineImpl

        public CommandlineImpl​(long timeout)
      • CommandlineImpl

        public CommandlineImpl​(boolean logEnabled)
      • CommandlineImpl

        public CommandlineImpl​(long timeout,
                               boolean logEnabled)
    • Method Detail

      • read

        protected ProcessOutput read​(java.lang.Process process)
                              throws java.lang.InterruptedException,
                                     java.io.IOException
        Throws:
        java.lang.InterruptedException
        java.io.IOException
      • checkFailure

        private void checkFailure​(StreamReader reader)
                           throws java.io.IOException,
                                  java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • log

        public void log​(java.lang.String text)
        Description copied from interface: Commandline
        Print some log information.
        Specified by:
        log in interface Commandline
      • log

        protected void log​(java.lang.String cmd,
                           java.lang.String[] envp,
                           java.io.File dir)
      • log

        protected void log​(java.lang.String[] cmdarray,
                           java.lang.String[] envp,
                           java.io.File dir)
      • execute

        public ProcessOutput execute​(java.lang.String cmd,
                                     java.lang.String[] environment,
                                     java.io.File dir)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        dir - file working directory
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • execute

        public ProcessOutput execute​(java.lang.String cmd,
                                     java.lang.String[] environment)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • execute

        public ProcessOutput execute​(java.lang.String cmd,
                                     java.io.File dir)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        dir - file working directory
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • execute

        public ProcessOutput execute​(java.lang.String cmd)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • execute

        public ProcessOutput execute​(java.lang.String[] cmd,
                                     java.lang.String[] environment,
                                     java.io.File dir)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        dir - file working directory
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • execute

        public ProcessOutput execute​(java.lang.String[] cmd,
                                     java.lang.String[] environment)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • execute

        public ProcessOutput execute​(java.lang.String[] cmd,
                                     java.io.File dir)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        dir - file working directory
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • execute

        public ProcessOutput execute​(java.lang.String[] cmd)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Execute command line
        Specified by:
        execute in interface Commandline
        Parameters:
        cmd - command line
        Returns:
        output of command
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • setTimeout

        public void setTimeout​(long timeout)
        Specified by:
        setTimeout in interface Commandline
      • setLogEnabled

        public void setLogEnabled​(boolean logEnabled)