File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Can somebody explain these lines of code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can somebody explain these lines of code?" Watch "Can somebody explain these lines of code?" New topic
Author

Can somebody explain these lines of code?

Klaas Vredevort
Greenhorn

Joined: Dec 27, 2005
Posts: 29


I don't understand the StringBuffer function in this file?
Joni Salonen
Ranch Hand

Joined: Jan 07, 2006
Posts: 53
It creates an empty StringBuffer in which you can put at least 128 characters, without needing to allocate more memory. If you add more than 128 characters it will have to allocate a new, larger internal character buffer.

You are given the option to specify the initial size because in a very tight loop reallocation may degrade performance. Which means that in 99% of the cases you don't need to do it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can somebody explain these lines of code?