code: public void setOutputWriter(Writer writer) {
          if (writer instanceof PrintWriter) {
              this.out = (PrintWriter) writer;
          } else if (writer == null) {
              this.out = null;
          } else {
              this.out = new PrintWriter(writer);
          }
      }
docs: Overwrites the default writer to which the output is directed.