public void toXMLUTF8 ( Object obj , OutputStream out ) throws IOException { Writer w = new OutputStreamWriter ( out , Charset . forName ( "UTF-8" ) ) ; w . write ( "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n" ) ; toXML ( obj , w ) ; }
Serializes to a byte stream . Uses UTF - 8 encoding and specifies that in the XML encoding declaration .