Encyclopedia > StringBuffer

  Article Content

StringBuffer

In computer programming, the StringBuffer class is one of two core string classes in Java. Most of the time, the String class is used. The point of this class is it is a mutable object while String is immutable (see immutable object). That means the content of StringBuffer objects can be modifed while every methods of string class returns a new string and result in improving runtime efficiency. For example, following code uses StringBuffer instead of String for performance improvement.
Reader reader = new FileReader ("file");
char buf[] = new char[10240];
StringBuffer sbuf = new StringBuffer ();
while (reader.ready ()) {
	sbuf.append (buf, 0, reader.read (buf));
}



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Thomas a Kempis

... place among their "exercises." John Wesley and John Newton put it among the works that influenced them at their conversion. General Gordon carried it with him to the ...

 
 
 
This page was created in 62.9 ms