Here's some code that may help . You have to make slight modifications based on
where you are getting the data to be written .

Santosh.

          FileOutputStream fos=null;
          String filename="your_filename";
          fos = new FileOutputStream(filename);

         int offset ,len ,oneChar, count=0;
         bytes[] xmldata;
          //xmldata = get xml data from your string variable and convert it to
byte array
          //write each line of xml into file
          {
             fos.write(xmldata,offset,;len);
             count = count + xmldata.length ;
          }
          fos.close();
          System.out.println(count + " byte(s) copied");








Aaron Prohaska <[EMAIL PROTECTED]> on 09/05/2000 03:16:47 PM

Please respond to A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Santosh Daryani/IT/Aon Consulting)

Subject:  Writing file to disk



Can someone show a newbie a simple example of writing a file to disk? I am
trying to dynamically write a xml file to a folder so that cocoon can
process that file.

thanks,

Aaron

                <<:::..:::...::: Aaron Prohaska :::..:::...:::>>
VerdeSoft Internet Services
mailto:[EMAIL PROTECTED]          http://www.verdesoft.net/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to