FileDocCategorySizeDatePackage
StringBufferPool.javaAPI DocJava SE 5 API1849Fri Aug 26 14:56:04 BST 2005com.sun.org.apache.xml.internal.utils

StringBufferPool

public class StringBufferPool extends Object
This class pools string buffers, since they are reused so often. String buffers are good candidates for pooling, because of their supporting character arrays.
xsl.usage
internal

Fields Summary
private static ObjectPool
m_stringBufPool
The global pool of string buffers.
Constructors Summary
Methods Summary
public static synchronized voidfree(com.sun.org.apache.xml.internal.utils.FastStringBuffer sb)
Return a string buffer back to the pool.

param
sb Must be a non-null reference to a string buffer.

    // Since this isn't synchronized, setLength must be 
    // done before the instance is freed.
    // Fix attributed to Peter Speck <speck@ruc.dk>.
    sb.setLength(0);
    m_stringBufPool.freeInstance(sb);
  
public static synchronized com.sun.org.apache.xml.internal.utils.FastStringBufferget()
Get the first free instance of a string buffer, or create one if there are no free instances.

return
A string buffer ready for use.


                               
      
  
    return (FastStringBuffer) m_stringBufPool.getInstance();