org.gcube.datatransformation.datatransformationlibrary.utils
Class CLIUtils

java.lang.Object
  extended by org.gcube.datatransformation.datatransformationlibrary.utils.CLIUtils

public class CLIUtils
extends Object

Author:
Dimitris Katris, NKUA Utility class which facilitates the execution of command line programs.

Constructor Summary
CLIUtils()
           
 
Method Summary
static void copyStream(InputStream input, OutputStream output)
           
static int executeCommand(String command)
          Executes a command in the underlying shell.
static int executeCommand(String command, InputStream input)
          Executes a command in the underlying shell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CLIUtils

public CLIUtils()
Method Detail

executeCommand

public static int executeCommand(String command)
                          throws Exception
Executes a command in the underlying shell.

Parameters:
command - The command which will be executed.
Returns:
The return code of the executed command.
Throws:
Exception - If the command could not be performed.

executeCommand

public static int executeCommand(String command,
                                 InputStream input)
                          throws Exception
Executes a command in the underlying shell.

Parameters:
command - The command which will be executed.
input - The input stream that should be piped to command execution.
Returns:
The return code of the executed command.
Throws:
Exception - If the command could not be performed.

copyStream

public static void copyStream(InputStream input,
                              OutputStream output)
                       throws IOException
Throws:
IOException


Copyright © 2013. All Rights Reserved.