org.apache.xml.utils
Class StringBufferPool

java.lang.Object
  extended byorg.apache.xml.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.


Field Summary
private static ObjectPool m_stringBufPool
          The global pool of string buffers.
 
Constructor Summary
StringBufferPool()
           
 
Method Summary
static void free(FastStringBuffer sb)
          Return a string buffer back to the pool.
static FastStringBuffer get()
          Get the first free instance of a string buffer, or create one if there are no free instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_stringBufPool

private static ObjectPool m_stringBufPool
The global pool of string buffers.

Constructor Detail

StringBufferPool

public StringBufferPool()
Method Detail

get

public static FastStringBuffer get()
Get the first free instance of a string buffer, or create one if there are no free instances.

Returns:
A string buffer ready for use.

free

public static void free(FastStringBuffer sb)
Return a string buffer back to the pool.

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