public class OutputStreamOption extends StringOption
OutputStream or Writer.
The option takes one parameter and recognize that as a File,
unless the parameter is '-', which is treated as System.out.
For example, users can write "-log build.log" and
you can open this file as an OutputStream,
or they can write "-log -" to send it to console.
If the option is unspecified, this will create OutputStream
that just discard the input.
This class can be extended to set the default output to change the interpretation of the unspecified state and "-".
CmdLineOption.Parametersvalue| Constructor and Description |
|---|
OutputStreamOption(String optionName) |
OutputStreamOption(String optionName,
String defaultValue) |
| Modifier and Type | Method and Description |
|---|---|
protected OutputStream |
createConsoleStream()
Called when the option is '-' to create the
OutputStream. |
protected OutputStream |
createNullStream()
Called when the option is not specified to create the default
OutputStream |
OutputStream |
createOutputStream()
Opens the specified file for writing.
|
Writer |
createWriter()
Opens the specified file for writing.
|
accepts, parseArgumentspublic OutputStreamOption(String optionName)
public OutputStream createOutputStream() throws IOException
IOExceptionprotected OutputStream createNullStream() throws IOException
OutputStreamIOExceptionprotected OutputStream createConsoleStream() throws IOException
OutputStream.IOExceptionpublic Writer createWriter() throws IOException
IOExceptionCopyright © 2003-2013 Kohsuke Kawaguchi. All Rights Reserved.