ColdBox Platform Version 2.6.3

coldbox.system.plugins
Class StringBuffer

WEB-INF.cftags.component
        extended by coldbox.system.frameworkSupertype
            extended by coldbox.system.plugin
                extended by coldbox.system.plugins.StringBuffer

public class StringBuffer
extends plugin

This CFC greatly increases the speed of string concatenation. CF strings are immutable. When you append a string to another string, a whole new string is created. This is fine for a small number of iterations but painfully slow and memory intensive for a large number of concatenation operations. This plugin switches between StringBuilder and StringBuffer if running under cf8


Constructor Summary
init(any controller)
 
Method Summary
 void append([string strIn=''])
          Append a string to the buffer.
 numeric capacity()
          Returns the current capacity of the String buffer.
 void delete(numeric startPos, numeric endPos)
          Removes the characters in a substring of this StringBuffer.
 string getString()
          Converts to a string representing the data in this string buffer.
 any getStringBuffer()
          Return the StringBuffer Java Object
 numeric indexOf(string inStr, [numeric fromPos='0'])
          Returns the index within this string of the first occurrence of the specified substring.
 void insertStr([numeric offSet='0'], string inStr)
          Inserts the string into this string buffer at an offset.
 numeric lastIndexOf(string inStr, [numeric fromPos='0'])
          Returns the index within this string of the last occurrence of the specified substring.
 numeric length()
          Returns the length (character count) of this string buffer.
 void replaceStr(numeric startPos, numeric endPos, string inStr)
          Replaces the chracters in a substring of this StringBuffer with characters in the specified inStr
 void reverseStr()
          The character sequence contained in this string buffer is replaced by the reverse of the sequence.
 void setLength(numeric newLength)
          Sets the length of this String buffer.
 plugin setup([string strIn=''], [numeric BufferLength='16'])
          initializes the StringBuffer CF/java object
 string substring(numeric startPos, [numeric endPos='[runtime expression]'])
          Returns a new String that contains a subsequence of characters currently contained in this StringBuffer.The substring begins at the specified index and extends to the end of the StringBuffer.
 
Methods inherited from class coldbox.system.plugin
getPluginDescription, getPluginName, getPluginVersion, getpluginPath, setPluginDescription, setPluginName, setPluginVersion
 
Methods inherited from class coldbox.system.frameworkSupertype
abort, announceInterception, dump, getColdboxOCM, getDatasource, getDebugMode, getHash, getInstance, getInterceptor, getMailSettings, getModel, getMyPlugin, getPlugin, getResource, getSetting, getSettingStructure, getSettingsBean, getcontroller, getfwLocale, htmlhead, include, includeUDF, locateDirectoryPath, locateFilePath, persistVariables, populateModel, relocate, renderExternalView, renderView, rethrowit, runEvent, setDebugMode, setNextEvent, setNextRoute, setSetting, setcontroller, settingExists, throw
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(any controller)

Method Detail

append

public void append([string strIn=''])
Append a string to the buffer.

Parameters:
strIn - a string to append to the buffer

capacity

public numeric capacity()
Returns the current capacity of the String buffer.


delete

public void delete(numeric startPos, numeric endPos)
Removes the characters in a substring of this StringBuffer.

Parameters:
startPos - The beginning index, inclusive.
endPos - The ending index, exclusive.

getString

public string getString()
Converts to a string representing the data in this string buffer.


getStringBuffer

public any getStringBuffer()
Return the StringBuffer Java Object


indexOf

public numeric indexOf(string inStr, [numeric fromPos='0'])
Returns the index within this string of the first occurrence of the specified substring.

Parameters:
inStr - the substring for which to search
fromPos - the index from which to start the search

insertStr

public void insertStr([numeric offSet='0'], string inStr)
Inserts the string into this string buffer at an offset.

Parameters:
offSet - the offset
inStr - a string

lastIndexOf

public numeric lastIndexOf(string inStr, [numeric fromPos='0'])
Returns the index within this string of the last occurrence of the specified substring.

Parameters:
inStr - the substring for which to search
fromPos - the index from which to start the search

length

public numeric length()
Returns the length (character count) of this string buffer.


replaceStr

public void replaceStr(numeric startPos, numeric endPos, string inStr)
Replaces the chracters in a substring of this StringBuffer with characters in the specified inStr

Parameters:
startPos - The beginning index, inclusive.
endPos - The ending index, exclusive.
inStr - a string

reverseStr

public void reverseStr()
The character sequence contained in this string buffer is replaced by the reverse of the sequence.


setLength

public void setLength(numeric newLength)
Sets the length of this String buffer.

Parameters:
newLength - Length in characters to set.

setup

public plugin setup([string strIn=''], [numeric BufferLength='16'])
initializes the StringBuffer CF/java object

Parameters:
strIn - A string to initialize the buffer with. The bufferLength will be the number of characters + 16. This argument is mutually exclusive to BufferLength
BufferLength - The length to start the buffer at. The default is 16 characters. This argument is mutually exclusive to strIn

substring

public string substring(numeric startPos, [numeric endPos='[runtime expression]'])
Returns a new String that contains a subsequence of characters currently contained in this StringBuffer.The substring begins at the specified index and extends to the end of the StringBuffer.

Parameters:
startPos - The beginning index, inclusive.
endPos - The ending index, exclusive.

ColdBox Platform Version 2.6.3