Class CommandlineImpl

  • All Implemented Interfaces:
    Commandline

    public class CommandlineImpl
    extends java.lang.Object
    implements Commandline
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ProcessOutput execute​(java.lang.String cmd)
      Execute command line
      ProcessOutput execute​(java.lang.String[] cmd)
      Execute command line
      ProcessOutput execute​(java.lang.String[] cmd, java.io.File dir)
      Execute command line
      ProcessOutput execute​(java.lang.String[] cmd, java.lang.String[] environment)
      Execute command line
      ProcessOutput execute​(java.lang.String[] cmd, java.lang.String[] environment, java.io.File dir)
      Execute command line
      ProcessOutput execute​(java.lang.String cmd, java.io.File dir)
      Execute command line
      ProcessOutput execute​(java.lang.String cmd, java.lang.String[] environment)
      Execute command line
      ProcessOutput execute​(java.lang.String cmd, java.lang.String[] environment, java.io.File dir)
      Execute command line
      long getTimeout()  
      boolean isLogEnabled()  
      void log​(java.lang.String text)
      Print some log information.
      protected void log​(java.lang.String[] cmdarray, java.lang.String[] envp, java.io.File dir)  
      protected void log​(java.lang.String cmd, java.lang.String[] envp, java.io.File dir)  
      protected ProcessOutput read​(java.lang.Process process)  
      void setLogEnabled​(boolean logEnabled)  
      void setTimeout​(long timeout)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
      • 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)