Please Suggest best way to pass Strings in a pipeline

I'm working in a project in which a line passes in a pipeline kind of situation.

The String is passed between different modules and each module adds some more data to it (or may even remove some of it).

Which is the best way to pass the String? I think java.lang.String might not be an efficient method because the String i'll be passing will be modified many times.

Thanx

[399 byte] By [LordZeusa] at [2007-11-27 6:55:49]
# 1
I'll use java.lang.StringBuilder (or StringBuffer)
S_i_m_ua at 2007-7-12 18:32:33 > top of Java-index,Java Essentials,Java Programming...
# 2

Yes. StringBuffer or StringBuilder you can use.

String string = "test";

StringBuffer sb = new StringBuffer(string);

later you will add some more strings to the StringBuffer

sb.append("Hello World");

No additiional String object will be created.

AnanSmritia at 2007-7-12 18:32:33 > top of Java-index,Java Essentials,Java Programming...
# 3

just another option, you can use String array with length = 1.

public void method(String[] str) {

// to use

str[0] = "pointer's brother";

}

j_shadinataa at 2007-7-12 18:32:33 > top of Java-index,Java Essentials,Java Programming...
# 4

> just another option, you can use String array with

> length = 1.

> > public void method(String[] str) {

>// to use

> str[0] = "pointer's brother";

> }

>

That would be quite useless.

-Kayaman-a at 2007-7-12 18:32:33 > top of Java-index,Java Essentials,Java Programming...