com.sapportals.portal.prt.util

Class SmartBuffer

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

public class SmartBuffer
extends Object

Implements a character buffer that can be substituted with the StringBuffer.Note that this class is not thread safe.
The internal buffer is created by default with a size of 32 Charaters. It automatically expands its buffer. Due to its usage, the initial buffer is never recreated is the buffer is reset. Copyright (c) SAP Portals Europe GmbH 2001


Field Summary
protected  char[] m_buff
           
protected  int m_length
           
 boolean m_shared
           
 
Method Summary
 SmartBuffer append(char ch)
           
 SmartBuffer append(char[] c)
           
 SmartBuffer append(char[] str, int o, int len)
           
 SmartBuffer append(double d)
          Appends the string representation of a double value to the buffer
 SmartBuffer append(int i)
           
 SmartBuffer append(String str)
           
 int capacity()
           
 char charAt(int index)
          The specified character of the sequence currently represented by the string buffer, as indicated by the index argument, is returned.
 void ensureCapacity(int minimumCapacity)
           
 int length()
           
 void reset()
           
 void setCharAt(int index, char ch)
          The character at the specified index of this string buffer is set to ch.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_shared

public boolean m_shared

m_buff

protected char[] m_buff

m_length

protected int m_length
Method Detail

append

public final SmartBuffer append(char ch)
Parameters:
ch -

append

public final SmartBuffer append(int i)
Parameters:
i -

ensureCapacity

public final void ensureCapacity(int minimumCapacity)
Parameters:
minimumCapacity -

append

public SmartBuffer append(char[] str,
                          int o,
                          int len)
Parameters:
str - String array
o -
len -

append

public SmartBuffer append(char[] c)
Parameters:
c - char array

append

public SmartBuffer append(String str)
Parameters:
str -

charAt

public char charAt(int index)
The specified character of the sequence currently represented by the string buffer, as indicated by the index argument, is returned. The first character of a string buffer is at index 0, the next at index 1, and so on, for array indexing.

The index argument must be greater than or equal to 0, and less than the length of this string buffer.

Parameters:
index - the index of the desired character.
Returns:
the character at the specified index of this string buffer.
Throws:
IndexOutOfBoundsException - if index is negative or greater than or equal to length().
See Also:
StringBuffer.length()

setCharAt

public void setCharAt(int index,
                      char ch)
The character at the specified index of this string buffer is set to ch. The string buffer is altered to represent a new character sequence that is identical to the old character sequence, except that it contains the character ch at position index.

The offset argument must be greater than or equal to 0, and less than the length of this string buffer.

Parameters:
index - the index of the character to modify.
ch - the new character.
Throws:
IndexOutOfBoundsException - if index is negative or greater than or equal to length().
See Also:
StringBuffer.length()

append

public SmartBuffer append(double d)
Appends the string representation of a double value to the buffer

Parameters:
d -

toString

public String toString()
Overrides:
toString in class Object

length

public final int length()

capacity

public final int capacity()

reset

public final void reset()
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] epbc.prtapi._apideprecated default EP-PIN-PRT


Copyright 2011 SAP AG Complete Copyright Notice