com.sapportals.portal.prt.util

Class SharedString

java.lang.Object
  extended by com.sapportals.portal.prt.util.SharedString

public class SharedString
extends Object

Class used by RecyclableStringBuffer to allow sharing the underlying char buffer, thus avoiding copying char[] along the call chain. In order to release the buffer into the pool, the consumer MUST call release() when he's done with the buffer.


Method Summary
 char[] getChars()
          In order to have the right char[], this method has to be used in conjonction with length().
 int length()
          The length of the useful char[].
 void release()
          Releases the underlying resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

release

public void release()
Releases the underlying resource.
this method must be called when the consumer is done with the Shared string.


getChars

public char[] getChars()
In order to have the right char[], this method has to be used in conjonction with length(). Otherwise you'll get the expected data plus all remaining data in the buffer which is not relevant in this context.

Returns:
the underlying full character array

length

public int length()
The length of the useful char[]. Caution : this value will always be most likely less than getChars().length !

Returns:
the lenght of relevant data in the buffer.
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] EP-BASIS-API [sap.com] tc/epbc/prt/api api EP-PIN
[sap.com] EP-BASIS-API [sap.com] tc/epbc/prt/lib/api api EP-PIN
[sap.com] EP-BASIS-API [sap.com] epbc.prtapi._apideprecated default EP-PIN-PRT


Copyright 2011 SAP AG Complete Copyright Notice