args4j
args4j copied to clipboard
In CmdLineParser the parse function accepts OutputStream but the usage shows parse(System.err)
The signature of the parse function is void parse(OutputStream out) and in CmdLineParser a writer is created using the output stream. In the usage, you are showing to use parse(System.err). System.err is an instance of PrintStream. Why can't the parse function directly use PrintStream directly? It is easy to subclass a print stream and pass it to parse instead of OutPutStream which need to handle bytes and flush functionality.
class PrintStream extends FilterOutputStream [ extends OutputStream ]
This means that any PrintStream is also an OutputStream. Therefore any PrintStream can be used with parse(OutputStream out).