APIdia Launch Partner
Top Description Inners Constructors Methods
jdk.internal.opt

public final Class CommandLine

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, .InputStreamReader, .Reader, java.nio.charset.Charset, java.nio.file.Files, .Paths, java.util.ArrayList, .List

Various utility methods for processing Java tool command line arguments.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
private static void
appendParsedEnvVariables(List<String> newArgs, String envVariable)

public static void
private static void
private static void
public static String[]
parse(String... args)

Convenient wrapper for the List-based parse method.

public static List<String>

Returns:

the arguments, with @files expanded
parse
(List<String>
the arguments that may contain @files
args
)

Process Win32-style command files for the specified command line arguments and return the resulting arguments.

public static List<String>

Returns:

the arguments, with environment variable's content and expansion of @files
parse
(String
the env variable to process
envVariable
,
List<String>
the arguments that may contain @files
args
)

Process the given environment variable and appends any Win32-style command files for the specified command line arguments and return the resulting arguments.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CommandLineback to summary
public CommandLine()

Method Detail

appendParsedCommandArgsback to summary
private static void appendParsedCommandArgs(List<String> newArgs, List<String> args) throws IOException
appendParsedEnvVariablesback to summary
private static void appendParsedEnvVariables(List<String> newArgs, String envVariable) throws UnmatchedQuote
Annotations
@SuppressWarnings:fallthrough
loadCmdFileback to summary
public static void loadCmdFile(InputStream in, List<String> args) throws IOException
loadCmdFileback to summary
private static void loadCmdFile(String name, List<String> args) throws IOException
loadCmdFileAndCloseReaderback to summary
private static void loadCmdFileAndCloseReader(Reader r, List<String> args) throws IOException
parseback to summary
public static String[] parse(String... args) throws IOException

Convenient wrapper for the List-based parse method.

See Also
parse(List)
parseback to summary
public static List<String> parse(List<String> args) throws IOException

Process Win32-style command files for the specified command line arguments and return the resulting arguments. A command file argument is of the form '@file' where 'file' is the name of the file whose contents are to be parsed for additional arguments. The contents of the command file are parsed using StreamTokenizer and the original '@file' argument replaced with the resulting tokens. Recursive command files are not supported. The '@' character itself can be quoted with the sequence '@@'.

Parameters
args:List<String>

the arguments that may contain @files

Returns:List<String>

the arguments, with @files expanded

Exceptions
IOException:
if there is a problem reading any of the @files
parseback to summary
public static List<String> parse(String envVariable, List<String> args) throws IOException, UnmatchedQuote

Process the given environment variable and appends any Win32-style command files for the specified command line arguments and return the resulting arguments. A command file argument is of the form '@file' where 'file' is the name of the file whose contents are to be parsed for additional arguments. The contents of the command file are parsed using StreamTokenizer and the original '@file' argument replaced with the resulting tokens. Recursive command files are not supported. The '@' character itself can be quoted with the sequence '@@'.

Parameters
envVariable:String

the env variable to process

args:List<String>

the arguments that may contain @files

Returns:List<String>

the arguments, with environment variable's content and expansion of @files

Exceptions
IOException:
if there is a problem reading any of the @files
jdk.internal.opt back to summary

public Class CommandLine.Tokenizer

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private final Reader

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

chback to summary
private int ch
inback to summary
private final Reader in

Constructor Detail

Tokenizerback to summary
public Tokenizer(Reader in) throws IOException

Method Detail

nextTokenback to summary
public String nextToken() throws IOException
skipWhiteback to summary
pack-priv void skipWhite() throws IOException
jdk.internal.opt back to summary

public Class CommandLine.UnmatchedQuote

extends Exception
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long
public final String

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

variableNameback to summary
public final String variableName

Constructor Detail

UnmatchedQuoteback to summary
pack-priv UnmatchedQuote(String variable)