outputStream

fun RawOption.outputStream(createIfNotExist: Boolean = true, truncateExisting: Boolean = false, fileSystem: FileSystem = FileSystems.getDefault()): NullableOption<OutputStream, OutputStream>

Convert the option to an OutputStream.

The value given on the command line must be either a path to a writable file, or -. If - is given, stdout will be used.

If stdout is used, the resulting OutputStream will be a proxy for System.out that will not close the underlying stream. So you can always close the resulting stream without worrying about accidentally closing System.out.

Parameters

createIfNotExist

If false, an error will be reported if the given value doesn't exist. By default, the file will be created.

truncateExisting

If true, existing files will be truncated when opened. By default, the file will be appended to.


fun RawArgument.outputStream(createIfNotExist: Boolean = true, truncateExisting: Boolean = false, fileSystem: FileSystem = FileSystems.getDefault()): ProcessedArgument<OutputStream, OutputStream>

Convert the argument to an OutputStream.

The value given on the command line must be either a path to a writable file, or -. If - is given, stdout will be used.

If stdout is used, the resulting OutputStream will be a proxy for System.out that will not close the underlying stream. So you can always close the resulting stream without worrying about accidentally closing System.out.

Parameters

createIfNotExist

If false, an error will be reported if the given value doesn't exist. By default, the file will be created.

truncateExisting

If true, existing files will be truncated when opened. By default, the file will be appended to.