From 984a96da0708edc70ecf03886c68d295b3392c69 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 9 Sep 2013 00:58:32 +0200 Subject: [PATCH] Fix write issue. --- src/fr/devinsy/util/StringListWriter.java | 44 ++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/fr/devinsy/util/StringListWriter.java b/src/fr/devinsy/util/StringListWriter.java index 378dbe7..bf9842d 100755 --- a/src/fr/devinsy/util/StringListWriter.java +++ b/src/fr/devinsy/util/StringListWriter.java @@ -49,6 +49,34 @@ public class StringListWriter extends Writer } + /* + * + */ + @Override + public String toString() + { + String result; + + result = this.out.toString(); + + // + return result; + } + + /** + * + * @return + */ + public StringList toStringList() + { + StringList result; + + result = this.out; + + // + return result; + } + /* * */ @@ -63,7 +91,21 @@ public class StringListWriter extends Writer @Override public void write(final char[] cbuf, final int off, final int len) throws IOException { - this.out.append(cbuf.toString().substring(off, len)); + char[] target; + if ((off == 0) && (cbuf.length == len)) + { + target = cbuf; + } + else + { + target = new char[len]; + for (int index = off; index < len; index++) + { + target[index] = cbuf[index]; + } + } + + this.out.append(target.toString()); } /*