1 Reply Latest reply on Jun 5, 2013 1:31 AM by jaikiran

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

    rameshchokkapu

      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.

       

      ex:

      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.