public final class FastStringBuffer
extends java.lang.Object
StringBuilder
, which
you should use in preference to this class.Modifier and Type | Field and Description |
---|---|
static int |
NOT_A_CHAR |
static int |
NOTACHAR
FastStringBuffer.NOTACHAR is used as a return value to indicate when
a fetch has run out of bounds
|
Constructor and Description |
---|
FastStringBuffer() |
FastStringBuffer(char[] cArray) |
FastStringBuffer(char[] cArray,
int offset,
int len) |
FastStringBuffer(char c,
int nChars) |
FastStringBuffer(int length) |
FastStringBuffer(java.lang.String str) |
Modifier and Type | Method and Description |
---|---|
FastStringBuffer |
append(char c) |
FastStringBuffer |
append(char[] str) |
FastStringBuffer |
append(char[] str,
int offset,
int len) |
FastStringBuffer |
append(char c,
int appendCount) |
FastStringBuffer |
append(FastStringBuffer fsb) |
FastStringBuffer |
append(java.lang.Object obj) |
FastStringBuffer |
append(java.lang.String str) |
int |
capacity() |
char |
charAt(int index) |
static char |
charFromString(java.lang.String s)
This method returns the first "logical" char value from the given
String.
|
static java.lang.String |
charToUnicodeEscape(char ch)
Returns a String containing a unicode escape sequence representing the given character.
|
char |
currentChar() |
void |
empty() |
static FastStringBuffer |
expandDelimiters(java.lang.String sourceString,
java.lang.String delimiters)
Creates a copy of the given FastStringBuffer, but will translate any
characters in the specified delimiter set into unicode "escape"
sequences (e.g.
|
char |
firstChar() |
char[] |
getChars()
Retrieves the contents of this FastStringBuffer.
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin) |
int |
getLength() |
int |
getOffset() |
char[] |
getValue() |
int |
indexOf(FastStringBuffer subStr,
int fromIndex)
Just like String.indexOf but uses FastStringBuffer
|
int |
indexOfSubstring(FastStringBuffer buffer,
int fromIndex) |
int |
IndexOfSubString(FastStringBuffer subStr,
int fromIndex)
Deprecated.
since 11.1.1. Use
indexOfSubstring(FastStringBuffer,int) . |
FastStringBuffer |
insert(int offset,
boolean b) |
FastStringBuffer |
insert(int offset,
char c) |
FastStringBuffer |
insert(int offset,
char[] str) |
FastStringBuffer |
insert(int offset,
java.lang.Object obj) |
FastStringBuffer |
insert(int offset,
java.lang.String str) |
char |
lastChar()
Returns the last character in the string and positions the offset
there.
|
int |
lastIndexOf(FastStringBuffer subStr,
int fromIndex)
Just like String.lastIndexOf but uses FastStringBuffer
|
int |
length() |
void |
makeroom(int minimumCapacity) |
char |
nextChar() |
FastStringBuffer |
normalizeDelimiters(java.lang.String delimiters)
The opposite of expandDelimiters, this method will turn any unicode escape sequences that
would result in one of the given delimiters characters into the displayable form of that
delimiters.
|
int |
offset() |
char |
parseBackSlash()
Given a FastStringBuffer where charAt(), nextChar() or priorChar()
have just returned the backslash character (in other words, where
value[offset] == '\\', this routine will parse the rest as a single
character backslash value (e.g.
|
FastStringBuffer |
parseLiteral()
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 will buffer
everything up to (but not including) another delimiter like the first.
|
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 will buffer
everything up to (but not including) another delimiter like the first.
|
char |
peekNextChar()
To be used in a firstChar()/nextChar() sort of loop, this method
peeks at the next character WITHOUT advancing any pointers.
|
char |
priorChar() |
void |
removeChar()
This method removes the "current" character from the buffer, where
"current" is defined by 'offset'.
|
void |
removeCharAt(int index)
This method removes the character from the buffer at value[offset].
|
void |
removeChars(int removeCount)
This method removes the specified number of characters from the current
position (where "current" is defined as value[offset].
|
void |
removeCharsAt(int index,
int removeCount)
This method will remove a number of characters from the buffer
|
void |
replaceCharAt(int index,
char c) |
void |
setCharAt(int index,
char ch) |
void |
setLength(int newLength) |
void |
setOffset(int offset) |
static FastStringBuffer |
sourceToText(java.lang.String source)
Translates a String which is compatible with source code (including
leading and trailing quote, expands backslash charaters, etc.) into
its actual String representation (e.g.
|
static java.lang.String |
stringFromChar(char c)
The opposite of charFromString, this method will return a String which best
represents the given char.
|
FastStringBuffer |
substring(int startPos,
int endPos)
Just like String.substring() but uses FastStringBuffer
|
static FastStringBuffer |
textToSource(java.lang.String text,
boolean hasEscapes)
Converts a String into a form that will compile (translating
special characters into backslash-something and adding
leading and trailing quotes.
|
static FastStringBuffer |
textToSource(java.lang.String text,
boolean hasEscapes,
java.lang.String indentString) |
java.lang.String |
toString() |
char[] |
value() |
public static final int NOTACHAR
public static final int NOT_A_CHAR
public FastStringBuffer()
public FastStringBuffer(int length)
public FastStringBuffer(java.lang.String str)
public FastStringBuffer(char[] cArray)
public FastStringBuffer(char[] cArray, int offset, int len)
public FastStringBuffer(char c, int nChars)
public void empty()
public char[] value()
public char[] getValue()
public int length()
public int getLength()
public int capacity()
public int offset()
public int getOffset()
public void setOffset(int offset)
public void makeroom(int minimumCapacity)
public void setLength(int newLength)
public char charAt(int index)
public char firstChar()
public char lastChar()
public char currentChar()
public char nextChar()
public char priorChar()
public char peekNextChar()
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
public char[] getChars()
public void setCharAt(int index, char ch)
public void removeCharAt(int index)
public void removeChar()
public void removeCharsAt(int index, int removeCount)
public void removeChars(int removeCount)
public void replaceCharAt(int index, char c)
public FastStringBuffer append(java.lang.Object obj)
public FastStringBuffer append(char c)
public FastStringBuffer append(char c, int appendCount)
public FastStringBuffer append(java.lang.String str)
public FastStringBuffer append(FastStringBuffer fsb)
public FastStringBuffer append(char[] str)
public FastStringBuffer append(char[] str, int offset, int len)
public FastStringBuffer insert(int offset, java.lang.Object obj)
public FastStringBuffer insert(int offset, java.lang.String str)
public FastStringBuffer insert(int offset, char[] str)
public FastStringBuffer insert(int offset, boolean b)
public FastStringBuffer insert(int offset, char c)
public int IndexOfSubString(FastStringBuffer subStr, int fromIndex)
indexOfSubstring(FastStringBuffer,int)
.public int indexOfSubstring(FastStringBuffer buffer, int fromIndex)
public int indexOf(FastStringBuffer subStr, int fromIndex)
public int lastIndexOf(FastStringBuffer subStr, int fromIndex)
public FastStringBuffer substring(int startPos, int endPos)
public java.lang.String toString()
toString
in class java.lang.Object
public char parseBackSlash()
public FastStringBuffer parseLiteral(char delimiter, boolean allowDouble)
delimiter
- the char value which will mark the end of the literal
allowDouble
- true means two delimiters in a row evaluate to a single
occurance of that literal in the string (and it is not a delimiter)
public FastStringBuffer parseLiteral()
public static FastStringBuffer expandDelimiters(java.lang.String sourceString, java.lang.String delimiters)
sourceString
- Contains a String to be scanned and
converted (though this
String itself will not be altered).
delimiters
- Contains a String consisting of the delimiters you
don't want to see in the output StringBuffer (e.g. new String("\t\r\n,").
Wherever these occur in the sourceString, they will be converted to a
unicode escape sequence.
public FastStringBuffer normalizeDelimiters(java.lang.String delimiters)
public static java.lang.String charToUnicodeEscape(char ch)
ch
- The character to be converted to a unicode escape sequencepublic static char charFromString(java.lang.String s)
public static java.lang.String stringFromChar(char c)
public static FastStringBuffer sourceToText(java.lang.String source)
public static FastStringBuffer textToSource(java.lang.String text, boolean hasEscapes)
public static FastStringBuffer textToSource(java.lang.String text, boolean hasEscapes, java.lang.String indentString)