[Design] Prevent flushing when writing out from the formatters.

Also make the XML formatter respect object as a return type.

Issues: MVC #1073, MVC #972

#1072 is a followup work item to add test coverage.

// CC @GrabYourPitchforks @harshgMSFT @danroth27 @sornaks @kichalla 
Use outputStream below in createXmlWriter.