3 Replies Latest reply on Jun 5, 2013 9:19 AM by Jean-Frederic Clere

    out.write(bytes[]) taking long time for large xml strings.

    Ramesh Chokkapu Newbie

      Hi  Good Morning,


      when i am writing response string to output stream. its taking long time. my string contains xml data. that xml data may in size of 5kb to 50mb.

      please tell me the best efficient way to write large xml strings into output stream.



      string size 1.3 mb then its take 59.4 seconds.(out.write(otaRSBytes)--> line no : 6)

                                    flush time : 4.3 seconds  (out.flush(); ---> line no : 7)


      code in myservlet:


      1. String otaRS = "xml string"; // large string          

      2. byte[] otaRSBytes = otaRS.getBytes();

      3. response.setContentType("text/xml");

      4. response.setCharacterEncoding("UTF-8");

      5  out = response.getOutputStream();

      // taking long time.

      6. out.write(otaRSBytes);                   

      7. out.flush();


      its very urgent.


      Thank You In Adavnce.