Class NativeShell


  • public class NativeShell
    extends Shell
    Default shell
    Author:
    Nils Geilen, Matthias Thimm
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String invokeExecutable​(java.lang.String commandline)
      Executes the given command on the commandline and returns the complete output.
      static java.lang.String invokeExecutable​(java.lang.String commandline, long maxLines)  
      static java.lang.String invokeExecutable​(java.lang.String commandline, long maxLines, boolean suppressErrors)
      Executes the given command on the commandline and returns the output up to a given number of lines.
      java.lang.String run​(java.lang.String cmd)
      runs command
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • run

        public java.lang.String run​(java.lang.String cmd)
                             throws java.lang.InterruptedException,
                                    java.io.IOException
        Description copied from class: Shell
        runs command
        Specified by:
        run in class Shell
        Parameters:
        cmd - the command to be run
        Returns:
        the terminal output
        Throws:
        java.lang.InterruptedException - if some interruption occurred.
        java.io.IOException - if some IO issue occurred.
      • invokeExecutable

        public static java.lang.String invokeExecutable​(java.lang.String commandline)
                                                 throws java.io.IOException,
                                                        java.lang.InterruptedException
        Executes the given command on the commandline and returns the complete output.
        Parameters:
        commandline - some command
        Returns:
        the output of the execution
        Throws:
        java.io.IOException - of an error was encountered.
        java.lang.InterruptedException - if some interruption occurred.
      • invokeExecutable

        public static java.lang.String invokeExecutable​(java.lang.String commandline,
                                                        long maxLines)
                                                 throws java.io.IOException,
                                                        java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • invokeExecutable

        public static java.lang.String invokeExecutable​(java.lang.String commandline,
                                                        long maxLines,
                                                        boolean suppressErrors)
                                                 throws java.io.IOException,
                                                        java.lang.InterruptedException
        Executes the given command on the commandline and returns the output up to a given number of lines.
        Parameters:
        commandline - some command
        maxLines - the maximum number of lines to be read (the process is killed afterwards)
        suppressErrors - if set to true, possible errors will not be included in the output
        Returns:
        the output of the execution
        Throws:
        java.io.IOException - of an error was encountered.
        java.lang.InterruptedException - if some interruption occurred.