|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.CommandLineArgs
public class CommandLineArgs
Command line option processing iwth arbitrary prefix support.
Nested Class Summary | |
---|---|
private static class |
CommandLineArgs.ArgReader
|
private static class |
CommandLineArgs.Prefix
Represent a single command line prefix |
private static class |
CommandLineArgs.PrefixType
Argument types |
Field Summary | |
---|---|
private static int |
app_name_pos
The position of application class name. |
private static CommandLineArgs.Prefix |
app_prefix
A catch-all prefix to find application name. |
private static CommandLineArgs.PrefixType[] |
arg_types
The types of each command line argument. |
private static String[] |
args
The command line arguments. |
private static boolean |
DEBUG
|
private static CommandLineArgs.Prefix[] |
prefixes
A list of possible prefixes for command line arguments. |
Constructor Summary | |
---|---|
CommandLineArgs()
|
Method Summary | |
---|---|
(package private) static void |
earlyProcessCommandLineArguments()
Stage1 processing of virtual machine directives appearing in argument list. |
(package private) static void |
fetchCommandLineArguments()
Fetch arguments from program command line. |
private static CommandLineArgs.Prefix |
findPrefix(CommandLineArgs.PrefixType type)
Find a Prefix object of a given type. |
static String[] |
getArgs(CommandLineArgs.PrefixType prefix)
Extract all command line arguments of a particular type. |
static String |
getBootstrapClasses()
Extract the classes that should go through bootstrap classloader. |
private static String |
getCWD()
|
static String |
getEnvironmentArg(String variable)
Extract the first -D... command line argument that matches a given variable, and return it. |
static String[] |
getEnvironmentArgs()
Get all environment arguments as pairs of string of key followed by value |
static String[] |
getJavaAgentArgs()
Extract command line arguments for the Java agent |
private static String |
getOsArch()
|
private static String |
getOsName()
|
private static String |
getOsVersion()
|
private static String |
getRvmRoot()
|
private static String |
getUserHome()
|
(package private) static String[] |
lateProcessCommandLineArguments()
Stage2 processing of virtual machine directives appearing in argument list. |
private static int |
length(String p)
The real length of the prefix. |
private static boolean |
matches(String arg,
String p)
Does the argument match the prefix? |
static long |
parseMemorySize(String sizeName,
String sizeFlag,
String defaultFactor,
int roundTo,
String fullArg,
String subArg)
Primitive parsing of memory sizes, with proper error handling, and so on. |
static float |
primitiveParseFloat(String arg)
Primitive parsing of float/double values. |
static int |
primitiveParseInt(String arg)
Primitive parsing of byte/integer numeric values. |
private static byte[] |
s2b(String arg)
Convenience method for calling stringToBytes |
private static byte[] |
stringToBytes(String argName,
String arg)
Convert the string s (the "argument") to a null-terminated byte array. |
private static int |
sysArg(int argno,
byte[] buf)
Read the argno 'th command line argument from the C argv |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static final CommandLineArgs.Prefix app_prefix
private static final CommandLineArgs.Prefix[] prefixes
Prefixes are normally matched with the start of the argument. If the last character of the prefix is a '$', the prefix (without the trailing '$') will be matched with the whole argument. If the last character of the prefix is a ' ' (space), the prefix (without the trailing ' ') will be matched with the whole argument, and the next argument will be appended to the end of the one matching the prefix, with a space in between.
The type will be used to classify the prefix. Multiple entries CAN have the same type.
private static String[] args
private static CommandLineArgs.PrefixType[] arg_types
private static int app_name_pos
Constructor Detail |
---|
public CommandLineArgs()
Method Detail |
---|
static void fetchCommandLineArguments()
private static boolean matches(String arg, String p)
arg
- argumentp
- prefix
private static int length(String p)
p
- prefix
private static CommandLineArgs.Prefix findPrefix(CommandLineArgs.PrefixType type)
type
- given type
null
otherwisepublic static String[] getArgs(CommandLineArgs.PrefixType prefix)
prefix
- type of arguments to extract
public static String[] getJavaAgentArgs()
public static String[] getEnvironmentArgs()
null
, if none were foundpublic static String getEnvironmentArg(String variable)
variable
- the non-null variable to match
private static String getRvmRoot()
private static String getUserHome()
private static String getCWD()
private static String getOsName()
private static String getOsVersion()
private static String getOsArch()
public static String getBootstrapClasses()
static void earlyProcessCommandLineArguments()
static String[] lateProcessCommandLineArguments()
private static int sysArg(int argno, byte[] buf)
argno
'th command line argument from the C argv
argno
- Number of argument soughtbuf
- Buffer to fill
public static float primitiveParseFloat(String arg)
Double.valueOf
would require.
Does not support the full Java specification.
arg
- the float value to parse
public static int primitiveParseInt(String arg)
Byte.parseByte
or Integer.parseInt
.
arg
- the int or byte value to parse
public static long parseMemorySize(String sizeName, String sizeFlag, String defaultFactor, int roundTo, String fullArg, String subArg)
private static byte[] s2b(String arg)
private static byte[] stringToBytes(String argName, String arg)
arg
- the argument to convertargName
- text to print for error reporting.
arg
as a
null
-terminated C string. Returns null
for a null
arg.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |