From 200fb1f3f45c24bf22e520e24bbf62212950b56e Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Wed, 3 Jul 2013 00:48:19 +0200 Subject: [PATCH] Improve string concatenation. --- src/fr/devinsy/xidyn/StringPresenter.java | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/fr/devinsy/xidyn/StringPresenter.java b/src/fr/devinsy/xidyn/StringPresenter.java index 9883930..3227f01 100644 --- a/src/fr/devinsy/xidyn/StringPresenter.java +++ b/src/fr/devinsy/xidyn/StringPresenter.java @@ -52,7 +52,11 @@ public class StringPresenter extends DomPresenter } else { - htmlSource = "\n" + html + ""; + StringBuffer buffer = new StringBuffer(html.length() + 100); + buffer.append("\n"); + buffer.append(html); + buffer.append(""); + htmlSource = buffer.toString(); } // StringBufferInputStream is deprecated so we use another solution. @@ -104,15 +108,6 @@ public class StringPresenter extends DomPresenter return (dynamize(datas.getIdsDataById())); } - /** - * - */ - public void setSource(final String html) - { - this.html = html; - this.doc = null; - } - /** * */ @@ -127,6 +122,15 @@ public class StringPresenter extends DomPresenter return (result); } + /** + * + */ + public void setSource(final String html) + { + this.html = html; + this.doc = null; + } + /** * Xid a string with html in. */