borland Packages Class Hierarchy jbcl.util Package Index
java.lang.Object +----borland.jbcl.util.FastStringBuffer
Variables Constructors Properties MethodsUse 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.
Warning: Because none of the FastStringBuffer methods are synchronized, these methods should not be used for objects which may be accessed simultaneously. FastStingBuffer is intended for rapid processing on local objects.
public static final int NOT_A_CHAR = 0The given character is invalid.
public static final int NOTACHAR = 0A fetch has run out of bounds.
public FastStringBuffer()Constructs a FastStringBuffer object with a default length of 16 characters (char[16]), offset and count are initialized to 0.
public FastStringBuffer(char c, int nChars)Constructs FastStringBuffer using the given number of repetitions and the given character.
Parameters:
public FastStringBuffer(char[] cArray)Constructs FastStringBuffer with the given character.
Parameters:
public FastStringBuffer(char[] cArray, int offset, int len)Constructs FastStringBuffer from the given character with the specified number of characters.
Parameters:
public FastStringBuffer(int length)Constructs an empty FastStringBuffer of the given length.
Parameters:
public FastStringBuffer(java.lang.String str)Constructs a new FastStringBuffer from the given string.
Parameters:
public int getLength() public void setLength(int newLength)Number of characters in the FastStringBuffer.
public int getOffset() public void setOffset(int offset)Current position in FastStringBuffer. See nextChar() for more information.
public char[] getValue()Returns the char[] storage used by FastStringBuffer.
public FastStringBuffer append(borland.jbcl.util.FastStringBuffer fsb)Apends one FastStringBuffer to another one.
Parameters:
public FastStringBuffer append(char c)Appends a character to the end of the buffer.
Parameters:
public FastStringBuffer append(char c, int appendCount)Appends the given number of repetitions of the given character to the buffer.
Parameters:
public FastStringBuffer append(char[] str)Appends the given character string.
Parameters:
public FastStringBuffer append(char[] str, int offset, int len)Appends the given string from the given offset for the given count.
Parameters:
public FastStringBuffer append(java.lang.Object obj)Appends the given object.
Parameters:
public FastStringBuffer append(java.lang.String str)Appends the given string.
Parameters:
public int capacity()Returns the amount of room in FastStringBuffer.
public char charAt(int index)Returns the character at the given position.
Parameters:
public static char charFromString(java.lang.String s)Returns the first "logical" char value from the given String. This means that it handles backslashes, Unicode escape sequences, and so on.
public static String charToUnicodeEscape(char ch)Returns a String containing a Unicode escape sequence representing the given character. For example, the following returns "\1" :
charToUnicodeEscape('1')
Parameters:
public char currentChar()Returns the character at offset.
public void empty()Nulls the FastStringBuffer.
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:
new String("\t\r\n,")
Wherever these occur in the sourceString, they are converted to a Unicode escape sequence.
public char firstChar()Sets offset() to 0 and returns to the first character in the buffer.
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
public int indexOf(borland.jbcl.util.FastStringBuffer subStr, int fromIndex)Similar to String.indexOf but uses FastStringBuffer.
public int IndexOfSubString(borland.jbcl.util.FastStringBuffer subStr, int fromIndex)Returns the position of the given string in FastStringBuffer. Returns the index -1 if the string is not found.
Parameters:
public FastStringBuffer insert(int offset, boolean b)Inserts the value of the given boolean at the given offset position.
Parameters:
public FastStringBuffer insert(int offset, char c)Inserts the given character at the given position.
Parameters:
public FastStringBuffer insert(int offset, char[] str)Inserts the given character string at the given offset position.
Parameters:
public FastStringBuffer insert(int offset, java.lang.Object obj)Inserts the given object at the given offset position.
Parameters:
public FastStringBuffer insert(int offset, java.lang.String str)Inserts the given string at the given offset position.
Parameters:
public char lastChar()Moves the offset() to the last character in FastStringBuffer and returns that character. Meant to be used as lastChar()/priorChar() loop. This method returns NOTACHAR if empty.
public int lastIndexOf(borland.jbcl.util.FastStringBuffer subStr, int fromIndex)Similar to String.lastIndexOf but uses FastStringBuffer.
public int length()Returns the number of actual characters in FastStringBuffer.
public void makeroom(int minimumCapacity)Increases the size of the FastStringBuffer so that it will hold at least the given number of characters.
Parameters:
public char nextChar()Moves the offset() to the next character in FastStringBuffer and returns that character.
public FastStringBuffer normalizeDelimiters(java.lang.String delimiters)Turns any Unicode escape sequences that would result in one of the given delimiter characters into the displayable form of that delimiter. This method is the opposite of expandDelimiters.
Note: Do NOT pass any non-displayable delimiters into this method, for example, '\r'.
Parameters:
public int offset()Internal current position in FastStringBuffer used by the following methods:
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.
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.
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:
public char peekNextChar()Used in a firstChar()/nextChar() type loop, this method peeks at the next character without advancing any pointers.
public char priorChar()Moves the offset() to the previous character in FastStringBuffer and returns that character. Meant to be used as lastChar()/priorChar() loop. This method returns NOTACHAR if empty.
public void removeChar()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.
public void removeCharAt(int index)Removes the character from the buffer at value[offset]. It adjusts 'offset' so a nextChar() loop finds the character immediately following the one removed.
public void removeChars(int removeCount)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.
public void removeCharsAt(int index, int removeCount)Removes a number of characters from the buffer.
public void replaceCharAt(int index, char c)
public void setCharAt(int index, char ch)
public static FastStringBuffer sourceToText(java.lang.String source)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:
public static String stringFromChar(char c)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:
public FastStringBuffer substring(int startPos, int endPos)Similar to String.substring() but uses FastStringBuffer.
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.
public static FastStringBuffer textToSource(java.lang.String text, boolean hasEscapes, java.lang.String indentString)
public String toString()Converts FastStringBuffer to a string.
Overrides: java.lang.Object.toString()
public char[] value()Returns the internal character string used by FastStringBuffer.