English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to build a very large string from lots and lots of small strings. In C# I would use System.Text.StringBuilder without hesitation. At present I am using java.io.StringWriter, but I am concerned that it may not be efficient enough? Is there a better option? MUST be FAST! Thanks in advance.

2007-02-13 07:31:39 · 1 answers · asked by Aaron W 3 in Computers & Internet Programming & Design

thanks. unfortunately I think I'm limited to 1.4 for this project.

2007-02-14 01:39:40 · update #1

1 answers

That is not what StringWriter is for. StringWriter is a character-based output stream that writes the bytes to memory.

Use java.lang.StringBuilder. It was added in Java 5 (JDK 1.5). It is similar to java.lang.StringBuffer, but without the synchronization. So, if you plan on designing your program such that only one thread will be using it, use the StringBuilder.

2007-02-13 15:34:53 · answer #1 · answered by vincentgl 5 · 0 0

fedest.com, questions and answers