• Post Reply Bookmark Topic Watch Topic
  • New Topic

OutputStreamWriter

 
M Radha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String encoding = "ISO-8859-1";
FileOutputStream fos = new FileOutputStream("result.xml");
OutputStreamWriter osw = new OutputStreamWriter(fos, encoding);
Marshaller marshaller = new Marshaller(osw);
marshaller.setEncoding(encoding);

Here how do i see the output of OutputStreamWriter.
 
Sid Murrey
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't Marshaller actually an interface? You should create a marshaller using the createMarshaller() method of a JAXBContext object and marshall your objects using the interface' marshal() method.
The code you posted does not generate any content and in fact I doubt it is compiling? But then again, I am a greenhorn :-)
I got all the information from http://java.sun.com/javase/6/docs/api/javax/xml/bind/Marshaller.html

Cheers,
Cedric
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by M Radha:

Here how do i see the output of OutputStreamWriter.


Open result.xml in an editor?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!