public final class Env
extends java.lang.Object
OptionProcessor operates in. Streams can be
used to read and write data provided by the user. It is also possible
to obtain current user directory. In future this class may be extended
with additional new getters that will describe the operating environment
in greater detail.| Modifier and Type | Method | Description |
|---|---|---|
java.io.File |
getCurrentDirectory() |
The directory relative file operations shall be relative to.
|
java.io.PrintStream |
getErrorStream() |
Get an output stream to which error messages may be sent.
|
java.io.InputStream |
getInputStream() |
Get an input stream that may supply additional data.
|
java.io.PrintStream |
getOutputStream() |
Get an output stream to which data may be sent.
|
void |
usage() |
Prints the help usage for current set of options.
|
public java.io.PrintStream getOutputStream()
public java.io.PrintStream getErrorStream()
public java.io.File getCurrentDirectory()
CommandLine.public java.io.InputStream getInputStream()
public void usage()
public class MyOptions implementsThis method finds associatedArgsProcessor{@Arg(longName="help") public boolean help;@Overridepublic void process(Envenv) { if (help) env.usage(); } }
CommandLine and calls its
usage method to print
the help text to getOutputStream().Built on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.