Eliminate some reflection via adding type hints, and correcting one

I am pretty sure that the print-dup method always takes a java.io.Writer as its second argument, not a java.io.OutputStream.  java.io.OutputStream has no write method whose argument is a string, only byte arrays or an int to write a single byte.