Writing a string to a file object

I have a String. as input. I need to write it to a file object I am finding bufferinputstream ...I need the file object as the program has to return a file object

public HashMap generateXML(String str)
        File f = new File("Product.xml");
        BufferedInputStream bis=null;
        BufferedOutputStream bos = null;
Who is Participating?
rama_krishna580Connect With a Mentor Commented:
try this..

String example = "<a>this is a test</a>";
File myFile = new File("Product.xml");
FileWriter fw = new FileWriter(myFile);

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.