args4j icon indicating copy to clipboard operation
args4j copied to clipboard

In CmdLineParser the parse function accepts OutputStream but the usage shows parse(System.err)

Open kishore25kumar opened this issue 7 years ago • 1 comments

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.

kishore25kumar avatar Apr 26 '17 14:04 kishore25kumar

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).

devconsole avatar Jul 12 '17 16:07 devconsole