submarine.util
Class CommandLine

java.lang.Object
  |
  +--submarine.util.CommandLine

public class CommandLine
extends java.lang.Object

Static class giving some tool functions for command line arguments

>java classe -option value

getArgument(args, "option") returns "value"

getArgumentEx(args, "option", aStringHolder) return true and aStringHolder.value=="value"

>java classe -option

getArgument(args, "option") returns ""

getArgumentEx(args, "option", aStringHolder) return true and aStringHolder.value==""


Constructor Summary
CommandLine()
           
 
Method Summary
static java.lang.String getArgument(java.lang.String[] args, java.lang.String option)
          Find the -option argument in args[] and returns the folowing argument if any
static boolean getArgumentEx(java.lang.String[] args, java.lang.String option, org.omg.CORBA.StringHolder result)
          Find the -option argument in args[] and fill result with the following argument if any
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

CommandLine

public CommandLine()
Method Detail

getArgument

public static java.lang.String getArgument(java.lang.String[] args,
                                           java.lang.String option)
Find the -option argument in args[] and returns the folowing argument if any
Parameters:
args - The arguments of the command line in the original order
option - The string to find after a minus (-) character in the arguments
Returns:
The following argument after -option or an empty string if -option is not found
See Also:
getArgumentEx(java.lang.String[], java.lang.String, org.omg.CORBA.StringHolder)

getArgumentEx

public static boolean getArgumentEx(java.lang.String[] args,
                                    java.lang.String option,
                                    org.omg.CORBA.StringHolder result)
Find the -option argument in args[] and fill result with the following argument if any
Parameters:
args - The arguments of the command line in the original order
option - The string to find after a minus (-) character in the arguments
result - A org.omg.CORBA.StringHolder to receive the option value
Returns:
True if the -option value was found in the argument list

False if the -option value was not found.


Submarine project. free distribution of this software must include the opensource licence.
Guénolé de Cadoudal.