"

2013 FRC Java API

"

com.sun.squawk.util
Class ArgsUtilities

java.lang.Object
  extended by com.sun.squawk.util.ArgsUtilities

public class ArgsUtilities
extends Object

A collection of utilities for command line argument parsing.


Field Summary
static String[] skipList
          Skip svn entries, etc...
 
Method Summary
static String[] cut(String str)
          Cuts a string of white space separated tokens into an array of strings, one element for each token.
static String[] expandArgFiles(String[] args)
          Expands any argfiles.
static String getOptArg(String[] args, int index, String opt)
          Gets the argument to a command line option.
static void processClassArg(String arg, Vector classes, Vector resources)
          Processes a single command line argument that specifies one or more class names or resource names.
static void processClassJarOrZipArg(String arg, Vector classes, Vector resources)
          Processes a single command line argument that specifies a jar or zip file of class files.
static void processClassListArg(String arg, Vector classes)
          Processes a single command line argument that specifies a file containing a set of class names, one per line.
static void processClasspathConnection(ClasspathConnection cp, Vector classes, Vector resources)
          Processes a single command line argument that specifies a jar or zip file of class files.
static void readArgFile(String name, Vector args)
          Processes a file containing command line arguments.
static void readLines(String file, Vector lines)
          Reads all the lines of a file into a given vector.
static String toPlatformPath(String path, boolean isClassPath)
          Converts a given file or class path to the correct format for the underlying platform.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

skipList

public static final String[] skipList
Skip svn entries, etc...

Method Detail

readLines

public static void readLines(String file,
                             Vector lines)
Reads all the lines of a file into a given vector.

Parameters:
file - the file to read
lines - the vector to augment

readArgFile

public static void readArgFile(String name,
                               Vector args)
Processes a file containing command line arguments. The file is parsed as a sequence of white space separated arguments.

Parameters:
name - the name of the args file
args - the vector of arguments to be added to

expandArgFiles

public static String[] expandArgFiles(String[] args)
Expands any argfiles. Finds any components in args that start with '@' (thus denoting a file containing more arguments) and expands the arguments inline in args. The expansion is not recursive.

Parameters:
args - the original command line arguments
Returns:
the given arguments with any inline argfiles expanded

toPlatformPath

public static String toPlatformPath(String path,
                                    boolean isClassPath)
Converts a given file or class path to the correct format for the underlying platform. For example, if the underlying platform uses '/' to separate directories in a file path then any instances of '\' in path will be converted to '/'.

Parameters:
path - to the path to convert
isClassPath - specifies if path is a class path
Returns:
the value of path reformatted (if necessary) to be correct for the underlying platform

processClassListArg

public static void processClassListArg(String arg,
                                       Vector classes)
Processes a single command line argument that specifies a file containing a set of class names, one per line.

Parameters:
arg - the command line argument to process
classes - the list of class names to augment

processClassJarOrZipArg

public static void processClassJarOrZipArg(String arg,
                                           Vector classes,
                                           Vector resources)
Processes a single command line argument that specifies a jar or zip file of class files.

Parameters:
arg - the command line argument to process
classes - the list of class names to augment
resources - the list of resource to augment

processClasspathConnection

public static void processClasspathConnection(ClasspathConnection cp,
                                              Vector classes,
                                              Vector resources)
Processes a single command line argument that specifies a jar or zip file of class files.

Parameters:
cp - the command line argument to process
classes - the list of class names to augment
resources - the list of resource to augment

processClassArg

public static void processClassArg(String arg,
                                   Vector classes,
                                   Vector resources)
Processes a single command line argument that specifies one or more class names or resource names.

Parameters:
arg - the command line argument to process
classes - the list of class names to augment
resources - Vector the list of resources to augment

cut

public static String[] cut(String str)
Cuts a string of white space separated tokens into an array of strings, one element for each token.

Parameters:
str - the string to cut
Returns:
'str' as an array of strings

getOptArg

public static String getOptArg(String[] args,
                               int index,
                               String opt)
Gets the argument to a command line option. If the argument is not provided, then a usage message is printed and RuntimeException is thrown.

Parameters:
args - the command line arguments
index - the index at which the option's argument is located
opt - the name of the option
Returns:
the value of the option's argument or null if it is missing

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"