com.sapportals.portal.prt.util
Class RecyclableStringBuffer

java.lang.Object
  |
  +--com.sapportals.portal.prt.util.RecyclableStringBuffer

public class RecyclableStringBuffer
extends java.lang.Object

RecyclableStringBuffer.java Created: Wed Jun 27 11:00:43 2001

Version:
$Revision: #3 $
$File:$ , $Revision:$ Last modified on $Date:$ by $Author:$ using $Change:$ Copyright (c) SAP Portals Europe GmbH 2001

Constructor Summary
RecyclableStringBuffer()
           
RecyclableStringBuffer(int size)
           
RecyclableStringBuffer(StringBufferPool pool)
           
 
Method Summary
 SmartBuffer getBuffer()
          Returns the underlying SmartBuffer object
 SharedString getSharedString()
          Obtains a SharedString Object that shares the same underlying buffer.
 void realloc(int size)
           
 void reset()
           
 java.lang.String toString()
          Returns the content of the buffer into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RecyclableStringBuffer

public RecyclableStringBuffer()

RecyclableStringBuffer

public RecyclableStringBuffer(int size)

RecyclableStringBuffer

public RecyclableStringBuffer(StringBufferPool pool)
Parameters:
pool -  
Method Detail

reset

public void reset()

realloc

public void realloc(int size)
Parameters:
size -  

getBuffer

public SmartBuffer getBuffer()
Returns the underlying SmartBuffer object

toString

public java.lang.String toString()
Returns the content of the buffer into a String. The value is copied.
Overrides:
toString in class java.lang.Object

getSharedString

public SharedString getSharedString()
Obtains a SharedString Object that shares the same underlying buffer.
From the SharedString object you can obtain the char[] and use it.
The different between this method and getString() is that there is no memory allocation when SharedString.getChars() is called. This is not the case with this.toString().
Returns:
a shared string based on the same internal buffer. Once you get a shared string you must call release on the object in order to be able to put the buffer in an eventual pool. The buffer is not back in the pool until all the shared strings have call release and an explicit release call is made on the pool itself.