borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.util 

FastStringBuffer component

java.lang.Object
   +----borland.jbcl.util.FastStringBuffer

About the FastStringBuffer component

Variables  Constructors  Properties  Methods  
Use the FastStringBuffer component to replace use of the StringBuffer class in those instances when a buffer is not shared. It removes some of the complications of synchronization and sharing.

FastStringBuffer variables

Variables implemented in this class

FastStringBuffer constructors

FastStringBuffer properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

FastStringBuffer methods

Methods implemented in this class

Methods implemented in java.lang.Object


FastStringBuffer variables

NOTACHAR

  public static final int NOTACHAR = 0
A constant used as a return value to indicate when a fetch has run out of bounds.

NOT_A_CHAR

  public static final int NOT_A_CHAR = 0

FastStringBuffer constructors

FastStringBuffer()

  public FastStringBuffer()

FastStringBuffer(char, int)

  public FastStringBuffer(char c, int nChars)

FastStringBuffer(char[])

  public FastStringBuffer(char[] cArray)

FastStringBuffer(char[], int, int)

  public FastStringBuffer(char[] cArray, int offset, int len)

FastStringBuffer(int)

  public FastStringBuffer(int length)

FastStringBuffer(java.lang.String)

  public FastStringBuffer(java.lang.String str)

FastStringBuffer properties

length

 public int getLength()
 public void setLength(int newLength)

offset

 public int getOffset()
 public void setOffset(int offset)

value

 public char[] getValue()

FastStringBuffer methods

IndexOfSubString(borland.jbcl.util.FastStringBuffer, int)

  public int IndexOfSubString(borland.jbcl.util.FastStringBuffer subStr, int fromIndex)

append(borland.jbcl.util.FastStringBuffer)

  public FastStringBuffer append(borland.jbcl.util.FastStringBuffer fsb)

append(char)

  public FastStringBuffer append(char c)

append(char, int)

  public FastStringBuffer append(char c, int appendCount)

append(char[])

  public FastStringBuffer append(char[] str)

append(char[], int, int)

  public FastStringBuffer append(char[] str, int offset, int len)

append(java.lang.Object)

  public FastStringBuffer append(java.lang.Object obj)

append(java.lang.String)

  public FastStringBuffer append(java.lang.String str)

capacity()

  public int capacity()

charAt(int)

  public char charAt(int index)

charFromString(java.lang.String)

  public static char charFromString(java.lang.String s)
This method returns the first "logical" char value from the given String. This means that it handles backslashes, Unicode escape sequences, and so on.

charToUnicodeEscape(char)

  public static String charToUnicodeEscape(char ch)
Returns a String containing a Unicode escape sequence representing the given character. For example,
charToUnicodeEscape('1')
returns the new String "\1".

Parameters:

ch
The character to be converted to a Unicode escape sequence.

currentChar()

  public char currentChar()

empty()

  public void empty()

expandDelimiters(java.lang.String, java.lang.String)

  public static FastStringBuffer expandDelimiters(java.lang.String sourceString, java.lang.String delimiters)
Creates a copy of the given FastStringBuffer, but translates any characters in the specified delimiter set into Unicode "escape" sequences. This allows the new FastStringBuffer to use the normal StringTokenizer for parsing. This method returns a new FastStringBuffer containing all the characters of the source String, but with all delimiters expanded to Unicode escape sequences.

Parameters:

sourceString
The String to be scanned and converted (this String itself is not altered).
delimiters
A String consisting of the delimiters you don't want to see in the output StringBuffer, for example,
 new String("\t\r\n,")
Wherever these occur in the sourceString, they are converted to a Unicode escape sequence.

firstChar()

  public char firstChar()

getChars(int, int, char[], int)

  public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)

insert(int, boolean)

  public FastStringBuffer insert(int offset, boolean b)

insert(int, char)

  public FastStringBuffer insert(int offset, char c)

insert(int, char[])

  public FastStringBuffer insert(int offset, char[] str)

insert(int, java.lang.Object)

  public FastStringBuffer insert(int offset, java.lang.Object obj)

insert(int, java.lang.String)

  public FastStringBuffer insert(int offset, java.lang.String str)

lastChar()

  public char lastChar()
Returns the last character in the String and positions the offset there. Meant to be used as lastChar()/priorChar() loop. This method returns FastStringBuffer.NOTACHAR if empty.

length()

  public int length()

makeroom(int)

  public void makeroom(int minimumCapacity)

nextChar()

  public char nextChar()

normalizeDelimiters(java.lang.String)

  public FastStringBuffer normalizeDelimiters(java.lang.String delimiters)
This method turns any Unicode escape sequences that would result in one of the given delimiter characters into the displayable form of that delimiters. This method is the opposite of expandDelimiters.

Note: Do NOT pass any nondisplayable delimiters into this method, for example, '\r'.

Parameters:

delimeters
The Unicode escape sequences.

offset()

  public int offset()

parseBackSlash()

  public char parseBackSlash()
Given a FastStringBuffer where charAt(), nextChar() or priorChar() have just returned the backslash character (in other words, where value[offset] == '\\'), this routine parses the rest as a single character backslash value (for example, "?") and advances the offset. It returns that character and leaves the FastStringBuffer pointing at the next character after the value.

parseLiteral()

  public FastStringBuffer parseLiteral()
Given a String which needs to be parsed as a literal String (including backslash characters), and assuming that value[offset] is currently pointing at the starting delimiter of this String, this routine buffers everything up to (but not including) another delimiter like the first. It advances the offset past that delimiter so that subsequent string processing can continue. It returns a new FastStringBuffer containing the literal.

parseLiteral(char, boolean)

  public FastStringBuffer parseLiteral(char delimiter, boolean allowDouble)
Given a string which needs to be parsed as a literal string (including backslash characters), and assuming value[offset] is currently pointing at the starting delimiter of this string, this routine buffers everything up to (but not including) another delimiter like the first. It advances the offset past that delimiter so subsequent string processing can continue. It returns a new FastStringBuffer containing the literal.

Parameters:

delimiter
The char value which marks the end of the literal.
allowDouble
A value of true indicates that two delimiters specified in a row evaluate to a single occurance of that literal in the string (and that it is not a delimiter).

peekNextChar()

  public char peekNextChar()
Used in a firstChar()/nextChar() type loop, this method peeks at the next character without advancing any pointers.

priorChar()

  public char priorChar()

removeChar()

  public void removeChar()
This method removes the "current" character from the buffer, where "current" is defined by 'offset'. It is intended to be used in a firstChar()/nextChar() loop. It adjusts 'offset' so that the next nextChar() method call functions properly.

removeCharAt(int)

  public void removeCharAt(int index)
This method removes the character from the buffer at value[offset]. It adjusts 'offset' so a nextChar() loop finds the character immediately following the one removed.

removeChars(int)

  public void removeChars(int removeCount)
This method removes the specified number of characters from the current position (where "current" is defined as value[offset]). It adjusts 'offset' so that the next nextChar() method call encounters the next character in the buffer.

removeCharsAt(int, int)

  public void removeCharsAt(int index, int removeCount)
This method removes a number of characters from the buffer.

replaceCharAt(int, char)

  public void replaceCharAt(int index, char c)

setCharAt(int, char)

  public void setCharAt(int index, char ch)

sourceToText(java.lang.String)

  public static FastStringBuffer sourceToText(java.lang.String source)
This method translates a String which is compatible with source code (including leading and trailing quote, expands backslash charaters, and so on) into its actual String representation. For example, the literal "\n" becomes the real linefeed character.

Parameters:

source
The String to translate.

stringFromChar(char)

  public static String stringFromChar(char c)
This method returns a String which best represents the given character. This means that it expands it into a Unicode escape sequence if needed. This method is the opposite of charFromString().

Parameters:

c
The character to expand.

textToSource(java.lang.String, boolean)

  public static FastStringBuffer textToSource(java.lang.String text, boolean hasEscapes)
Converts a String into a form that compiles, translating special characters into their backslash-combination equivalents, and adding leading and trailing quotes.

toString()

  public String toString()

Overrides: java.lang.Object.toString()

value()

  public char[] value()