Solved

Writing a string to a file object

Posted on 2007-11-14
1
182 Views
Last Modified: 2010-03-30
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;
       
0
Comment
Question by:rmvprasad
1 Comment
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 125 total points
ID: 20284690
try this..

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

R.K
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This video teaches viewers about errors in exception handling.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now