|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.util.text.XStringBufBase
public abstract class XStringBufBase
Abstract base class for XStringBuffer and XStringBuilder. This class exists to share common functionality, pushing appropriate details to the underlying implementation.
XStringBuffer,
XStringBuilder,
StringBuffer,
StringBuilder| Field Summary | |
|---|---|
static char |
METACHAR_SEQUENCE_START
The character that denotes the start of a metacharacter sequence. |
| Method Summary | |
|---|---|
XStringBufBase |
append(boolean val)
Append the string representation of a boolean value to the buffer. |
XStringBufBase |
append(char c)
Append the specified character to the buffer. |
XStringBufBase |
append(char[] chars)
Append the specified array of characters to the buffer. |
XStringBufBase |
append(char[] chars,
int offset,
int len)
Append the specified characters in a character array to the buffer. |
XStringBufBase |
append(java.lang.CharSequence csq)
Append the entire contents of the specified CharSequence to the buffer. |
XStringBufBase |
append(java.lang.CharSequence csq,
int start,
int end)
Append a subsequence of the specified CharSequence to the buffer. |
XStringBufBase |
append(double val)
Append the string representation of a double value to the buffer. |
XStringBufBase |
append(float val)
Append the string representation of a float value to the buffer. |
XStringBufBase |
append(int val)
Append the string representation of a int value to the buffer. |
XStringBufBase |
append(long val)
Append the string representation of a long value to the buffer. |
XStringBufBase |
append(java.lang.Object obj)
Append the string representation of an object to the buffer. |
XStringBufBase |
append(short val)
Append the string representation of a short value to the buffer. |
XStringBufBase |
append(java.lang.String s)
Append the specified string to the buffer. |
char |
charAt(int index)
Return the character at a specified index in the buffer. |
void |
clear()
Removes all characters from the buffer leaving it empty. |
void |
decodeMetacharacters()
A version of decodeMetacharacters
that processes the entire string buffer. |
void |
decodeMetacharacters(int start,
int end)
Replaces any metacharacter sequences in a portion of the string buffer (such as those produced by encodeMetacharacters()
with their actual characters. |
XStringBufBase |
delete(int start,
int end)
Remove the characters in a substring of this XStringBuffer. |
boolean |
delete(java.lang.String substring)
Delete the first occurrence of a given substring in the buffer. |
protected abstract void |
deleteCharacters(int start,
int end)
Remove the characters in a substring of this XStringBuffer. |
void |
encodeMetacharacters()
A version of encodeMetacharacters
that processes the entire string buffer. |
void |
encodeMetacharacters(int start,
int end)
Replaces certain characters in the string buffer with Java metacharacter ("backslash") sequences. |
protected abstract java.lang.Appendable |
getBufferAsAppendable()
Get the underlying buffer (e.g., StringBuffer, StringBuilder) as an Appender object. |
protected abstract java.lang.CharSequence |
getBufferAsCharSequence()
Get the underlying buffer (e.g., StringBuffer, StringBuilder) as a CharSequence object. |
abstract void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Copy the some or all of the contents of the buffer into a character array. |
int |
indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character. |
int |
indexOf(java.lang.String str)
Returns the index within this string of the first occurrence of the specified substring in this sequence, starting at position 0. |
int |
indexOf(java.lang.String str,
int start)
Returns the index within this string of the first occurrence of the specified substring in this sequence, with the search starting at the specified position. |
XStringBufBase |
insert(int index,
boolean val)
Insert the string representation of a booleanvalue into the buffer at a specified position. |
XStringBufBase |
insert(int index,
char ch)
Insert a single character at a specified position in the buffer. |
XStringBufBase |
insert(int index,
char[] chars)
Insert the contents of a character array into the buffer at a specified position. |
XStringBufBase |
insert(int index,
char[] chars,
int offset,
int len)
Insert characters from a character array into the buffer at a specified position. |
XStringBufBase |
insert(int index,
double val)
Insert the string representation of a doublevalue into the buffer at a specified position. |
XStringBufBase |
insert(int index,
float val)
Insert the string representation of a floatvalue into the buffer at a specified position. |
XStringBufBase |
insert(int index,
int val)
Insert the string representation of a intvalue into the buffer at a specified position. |
XStringBufBase |
insert(int index,
long val)
Insert the string representation of a longvalue into the buffer at a specified position. |
XStringBufBase |
insert(int index,
java.lang.Object obj)
Insert the string representation of an arbitrary object into the buffer at a specified position. |
XStringBufBase |
insert(int index,
short val)
Insert the string representation of a shortvalue into the buffer at a specified position. |
XStringBufBase |
insert(int index,
java.lang.String s)
Insert the contents of a string into the buffer at a specified position. |
protected abstract void |
insertCharacter(int index,
char ch)
Insert a single character into the buffer at a specified position. |
protected abstract void |
insertCharacters(int index,
char[] chars,
int offset,
int len)
Insert characters from a character array into the buffer at a specified position. |
int |
length()
Return the number of characters currently in the buffer. |
protected abstract java.lang.CharSequence |
newBufferAsCharSequence()
Get a new instance of the underlying buffer type (e.g., StringBuffer, StringBuilder) as a CharSequence object. |
XStringBufBase |
replace(int start,
int end,
java.lang.String str)
Replace the characters in a substring of this buffer with characters in the specified String. |
boolean |
replace(java.lang.String substring,
char replacement)
Replace the first occurrence of a given substring in the buffer with a given character |
boolean |
replace(java.lang.String substring,
java.lang.String replacement)
Replace the first occurrence of a given substring in the buffer with another substring. |
int |
replaceAll(char ch,
char replacement)
Replace the all occurrences of a given character in the buffer with another character. |
int |
replaceAll(char ch,
java.lang.String replacement)
Replace the all occurrences of a given character in the buffer with string. |
int |
replaceAll(java.lang.String substring,
java.lang.String replacement)
Replace the all occurrences of a given substring in the buffer with another substring. |
protected abstract void |
replaceString(int start,
int end,
java.lang.String str)
Replace the characters in a substring of this buffer with characters in the specified String. |
void |
reset(java.lang.String str)
Removes all existing characters from the buffer and loads the string into the buffer. |
java.lang.String[] |
split()
Split the contents of a buffer on white space, and return the resulting strings. |
java.lang.String[] |
split(char delim)
Split the contents of a buffer on a delimiter, and return the resulting strings. |
int |
split(char delim,
java.util.Collection<java.lang.String> collection)
Split the contents of a buffer on a delimiter, and store the resulting strings in a specified Collection. |
java.lang.String[] |
split(java.lang.String delimSet)
Split the contents of a buffer on a delimiter, and return the resulting strings. |
int |
split(java.lang.String delimSet,
java.util.Collection<java.lang.String> collection)
Split the contents of a buffer on a delimiter, and store the resulting strings in a specified Collection. |
java.lang.CharSequence |
subSequence(int start,
int end)
Return a new CharSequence object (really, another XStringBuffer0 that contains a subsequence of characters currently contained in this buffer. |
java.lang.String |
substring(int index)
Return a new String that contains a subsequence of characters currently contained in this buffer. |
java.lang.String |
substring(int start,
int end)
Return a new String that contains a subsequence of characters currently contained in this buffer. |
java.lang.String |
toString()
Return the String representation of this buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final char METACHAR_SEQUENCE_START
| Method Detail |
|---|
public abstract void getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
throws java.lang.IndexOutOfBoundsException
srcBegin - Start copy from this offset in the string buffersrcEnd - Stop copy from this offset in the string bufferdst - Where to copy the characters.dstBegin - Offset into dst
java.lang.IndexOutOfBoundsException - invalid indexprotected abstract java.lang.Appendable getBufferAsAppendable()
protected abstract java.lang.CharSequence getBufferAsCharSequence()
protected abstract java.lang.CharSequence newBufferAsCharSequence()
protected abstract void deleteCharacters(int start,
int end)
throws java.lang.IndexOutOfBoundsException
start - The beginning index, inclusiveend - The ending index, exclusive
java.lang.IndexOutOfBoundsException - if start is negative,
greater than length(),
or greater than end
protected abstract void insertCharacter(int index,
char ch)
index - Where to start inserting in the string bufferch - The character to insert
protected abstract void insertCharacters(int index,
char[] chars,
int offset,
int len)
index - Where to start inserting in the string bufferchars - The character(s) to insertoffset - The starting position in the chars arraylen - The number of characters to insert
protected abstract void replaceString(int start,
int end,
java.lang.String str)
throws java.lang.IndexOutOfBoundsException
start - The beginning index, inclusiveend - The ending index, exclusivestr - The string that will replace the previous contents
java.lang.IndexOutOfBoundsException - if start is negative,
or greater than
length(), or greater
than endpublic XStringBufBase append(boolean val)
val - The boolean value.
public XStringBufBase append(char c)
append in interface java.lang.Appendablec - The character to append.
java.io.IOException - I/O errorpublic XStringBufBase append(char[] chars)
chars - The characters to append.
public XStringBufBase append(char[] chars,
int offset,
int len)
chars - The characters to append.offset - The index of the first character to appendlen - The maximum number of characters to append
public XStringBufBase append(double val)
val - The double value.
public XStringBufBase append(float val)
val - The float value.
public XStringBufBase append(int val)
val - The int value.
public XStringBufBase append(long val)
val - The long value.
public XStringBufBase append(java.lang.Object obj)
obj - The object whose string value is to be appended.
public XStringBufBase append(short val)
val - The short value.
public XStringBufBase append(java.lang.String s)
s - The string to append.
public XStringBufBase append(java.lang.CharSequence csq)
append in interface java.lang.Appendablecsq - The CharSequence to append
append(CharSequence,int,int)
public XStringBufBase append(java.lang.CharSequence csq,
int start,
int end)
append in interface java.lang.Appendablecsq - The CharSequence to appendstart - The starting index of the subsequenceend - One past the ending index of the subsequence
append(CharSequence)
public char charAt(int index)
throws java.lang.IndexOutOfBoundsException
charAt in interface java.lang.CharSequenceindex - The index of the character to return
java.lang.IndexOutOfBoundsException - if index is negative or
greater than or equal to
length()public boolean delete(java.lang.String substring)
substring - The substring to find and replace
public void clear()
public XStringBufBase delete(int start,
int end)
throws java.lang.IndexOutOfBoundsException
start - The beginning index, inclusiveend - The ending index, exclusive
java.lang.IndexOutOfBoundsException - if start is negative,
greater than length(),
or greater than end
public void encodeMetacharacters(int start,
int end)
throws java.lang.IndexOutOfBoundsException,
java.io.IOException
Replaces certain characters in the string buffer with Java metacharacter ("backslash") sequences.
This method uses the same definition of "non-printable" as
TextUtil.isPrintable(char).
start - The beginning index, inclusiveend - The ending index, exclusive
java.lang.StringIndexOutOfBoundsException - if start is negative,
or greater than
length(), or greater
than end
java.io.IOException - I/O exception
java.lang.IndexOutOfBoundsExceptionencodeMetacharacters(),
decodeMetacharacters(int, int)public void encodeMetacharacters()
encodeMetacharacters
that processes the entire string buffer. Calling this method is
equivalent to:
buf.encodeMetacharacters (0, buf.length())
encodeMetacharacters(int, int),
decodeMetacharacters()
public void decodeMetacharacters(int start,
int end)
throws java.lang.StringIndexOutOfBoundsException
encodeMetacharacters()
with their actual characters.
start - The beginning index, inclusiveend - The ending index, exclusive
java.lang.StringIndexOutOfBoundsException - if start is negative,
or greater than
length(), or greater
than enddecodeMetacharacters(),
encodeMetacharacters(int,int)public void decodeMetacharacters()
decodeMetacharacters
that processes the entire string buffer. Calling this method is
equivalent to:
buf.decodeMetacharacters (0, buf.length())
encodeMetacharacters(int, int),
decodeMetacharacters()public int indexOf(int ch)
ch - the cahracter (Unicode code point)
public int indexOf(java.lang.String str)
str - the string to find
public int indexOf(java.lang.String str,
int start)
str - the string to findstart - the index at which to start the search
public XStringBufBase insert(int index,
boolean val)
index - Where to start inserting in the string bufferval - The boolean value
public XStringBufBase insert(int index,
char ch)
index - Where to start inserting in the string bufferch - The character to insert.
public XStringBufBase insert(int index,
char[] chars)
index - Where to start inserting in the string bufferchars - The character array.
public XStringBufBase insert(int index,
char[] chars,
int offset,
int len)
index - Where to start inserting in the string bufferchars - The character array.offset - The index of the first character to insertlen - The maximum number of characters to insert
public XStringBufBase insert(int index,
double val)
index - Where to start inserting in the string bufferval - The double value
public XStringBufBase insert(int index,
float val)
index - Where to start inserting in the string bufferval - The float value
public XStringBufBase insert(int index,
int val)
index - Where to start inserting in the string bufferval - The int value
public XStringBufBase insert(int index,
long val)
index - Where to start inserting in the string bufferval - The long value
public XStringBufBase insert(int index,
short val)
index - Where to start inserting in the string bufferval - The short value
public XStringBufBase insert(int index,
java.lang.Object obj)
index - Where to start inserting in the string bufferobj - The object whose string representation is to be inserted
public XStringBufBase insert(int index,
java.lang.String s)
index - Where to start inserting in the string buffers - The string to insertpublic int length()
length in interface java.lang.CharSequence
public XStringBufBase replace(int start,
int end,
java.lang.String str)
throws java.lang.StringIndexOutOfBoundsException
start - The beginning index, inclusiveend - The ending index, exclusivestr - The string that will replace the previous contents
java.lang.StringIndexOutOfBoundsException - if start is negative,
or greater than
length(), or greater
than end
public boolean replace(java.lang.String substring,
java.lang.String replacement)
substring - The substring to find and replacereplacement - The replacement string
public boolean replace(java.lang.String substring,
char replacement)
substring - The substring to find and replacereplacement - The replacement char
public int replaceAll(java.lang.String substring,
java.lang.String replacement)
substring - The substring to find and replacereplacement - The replacement string
public int replaceAll(char ch,
char replacement)
ch - The character to find and replacereplacement - The replacement character
public int replaceAll(char ch,
java.lang.String replacement)
ch - The character to find and replacereplacement - The replacement string
public void reset(java.lang.String str)
str - String object to be loaded into the cleared buffer.public java.lang.String[] split()
TextUtil.split(String).
split(String),
TextUtil.split(String,char)public java.lang.String[] split(char delim)
TextUtil.split(String,char).
delim - the delimiter
split(String),
TextUtil.split(String,char)public java.lang.String[] split(java.lang.String delimSet)
TextUtil.split(String,String)
delimSet - the delimiter set
split(char),
TextUtil.split(String,String)
public int split(char delim,
java.util.Collection<java.lang.String> collection)
TextUtil.split(String,char,Collection).
delim - the delimitercollection - where to store the resulting strings
split(String,Collection),
split(char),
TextUtil.split(String,char),
TextUtil.split(String,String,Collection)
public int split(java.lang.String delimSet,
java.util.Collection<java.lang.String> collection)
TextUtil.split(String,char,Collection).
delimSet - the set of delimiterscollection - where to store the resulting strings
split(char,Collection),
split(String),
TextUtil.split(String,String),
TextUtil.split(String,char,Collection)
public java.lang.String substring(int index)
throws java.lang.StringIndexOutOfBoundsException
index - The beginning index, inclusive
java.lang.StringIndexOutOfBoundsException - index out of range
public java.lang.String substring(int start,
int end)
throws java.lang.StringIndexOutOfBoundsException
start - The beginning index, inclusiveend - The beginning index, exclusive
java.lang.StringIndexOutOfBoundsException - if start is negative,
greater than length(),
or greater than endsubSequence(int, int)
public java.lang.CharSequence subSequence(int start,
int end)
throws java.lang.IndexOutOfBoundsException
subSequence in interface java.lang.CharSequencestart - The beginning index, inclusiveend - The beginning index, exclusive
java.lang.IndexOutOfBoundsException - if start is negative,
greater than length(),
or greater than endpublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||