Added a thin wrapper so that print & prettyPrint can use java.io.Writer rather than just java.io.PrintWriter.
Added a flush on printing.