com.compomics.software
Class CommandLineUtils

java.lang.Object
  extended by com.compomics.software.CommandLineUtils

public class CommandLineUtils
extends java.lang.Object

This class groups some convenience methods for the use of compomics tools in command line.

Author:
Marc Vaudel

Field Summary
static java.lang.String SEPARATOR
          The command line argument separator.
 
Constructor Summary
CommandLineUtils()
           
 
Method Summary
static java.lang.String concatenate(java.util.ArrayList<java.lang.String> args)
          Returns the list of arguments as space separated string for the command line.
static java.lang.String concatenate(java.lang.String[] args)
          Returns the list of arguments as space separated string for the command line.
static java.lang.String getCommandLineArgument(java.util.ArrayList<java.io.File> files)
          Returns the list of file as argument for the command line.
static java.lang.String getCommandLineArgument(java.io.File file)
          Returns the file as argument for the command line.
static java.util.ArrayList<java.io.File> getFiles(java.lang.String optionInput, java.util.ArrayList<java.lang.String> fileExtentions)
          Returns a list of files as imported from the command line option.
static java.util.ArrayList<java.lang.String> splitInput(java.lang.String cliInput)
          Returns a list of file names for inputs of comma separated files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

public static final java.lang.String SEPARATOR
The command line argument separator.

See Also:
Constant Field Values
Constructor Detail

CommandLineUtils

public CommandLineUtils()
Method Detail

getCommandLineArgument

public static java.lang.String getCommandLineArgument(java.util.ArrayList<java.io.File> files)
Returns the list of file as argument for the command line.

Parameters:
files - the files
Returns:
the list of file as string for command line argument

concatenate

public static java.lang.String concatenate(java.util.ArrayList<java.lang.String> args)
Returns the list of arguments as space separated string for the command line.

Parameters:
args - the arguments
Returns:
a comma separated string

concatenate

public static java.lang.String concatenate(java.lang.String[] args)
Returns the list of arguments as space separated string for the command line.

Parameters:
args - the arguments
Returns:
a comma separated string

getCommandLineArgument

public static java.lang.String getCommandLineArgument(java.io.File file)
Returns the file as argument for the command line.

Parameters:
file - the file
Returns:
the list of file as string for command line argument

splitInput

public static java.util.ArrayList<java.lang.String> splitInput(java.lang.String cliInput)
Returns a list of file names for inputs of comma separated files.

Parameters:
cliInput - the CLI input
Returns:
a list of file names

getFiles

public static java.util.ArrayList<java.io.File> getFiles(java.lang.String optionInput,
                                                         java.util.ArrayList<java.lang.String> fileExtentions)
                                                  throws java.io.FileNotFoundException
Returns a list of files as imported from the command line option.

Parameters:
optionInput - the command line option
fileExtentions - the file extensions to be considered
Returns:
a list of file candidates
Throws:
java.io.FileNotFoundException - exception thrown whenever a file is not found


Copyright © 2013. All Rights Reserved.