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
Canadian Charter of Rights and Freedoms

... the movement to entrench a charter as contrary to the British model of Parliamentary supremacy. Ironically, some would say that the European Convention on Human Right ...

 
 
 
This page was created in 26 ms