Package org.lionsoul.jcseg.util
Class IStringBuffer
- java.lang.Object
-
- org.lionsoul.jcseg.util.IStringBuffer
-
- All Implemented Interfaces:
Serializable
public class IStringBuffer extends Object implements Serializable
string buffer class- Author:
- chenxin
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IStringBuffer()create a buffer with a default length 16IStringBuffer(int length)create a buffer with a specified lengthIStringBuffer(String str)create a buffer with a specified string
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IStringBufferappend(boolean bool)append a boolean valueIStringBufferappend(char c)append a char to the bufferIStringBufferappend(char[] chars)append some chars to the bufferIStringBufferappend(char[] chars, int start)append the rest of the chars to the bufferIStringBufferappend(char[] chars, int start, int length)append parts of the chars to the bufferIStringBufferappend(double doublev)append a double valueIStringBufferappend(float floatv)append a float valueIStringBufferappend(int intv)append a int valueIStringBufferappend(long longv)append a long valueIStringBufferappend(short shortv)append a short valueIStringBufferappend(String str)append a string to the bufferchar[]buffer()return the chars of the buffercharcharAt(int idx)get the char at a specified position in the bufferIStringBufferclear()clear the buffer by reset the count to 0IStringBufferdeleteCharAt(int idx)delete the char at the specified positioncharfirst()always return the first charcharlast()always return the last charintlength()return the length of the buffervoidset(int idx, char chr)set the char at the specified indexintsetLength(int length)set the length of the buffer actually it just override the count and the actual buffer has nothing changedStringtoString()return the string of the current buffer
-
-
-
Constructor Detail
-
IStringBuffer
public IStringBuffer()
create a buffer with a default length 16
-
IStringBuffer
public IStringBuffer(int length)
create a buffer with a specified length- Parameters:
length-
-
IStringBuffer
public IStringBuffer(String str)
create a buffer with a specified string- Parameters:
str-
-
-
Method Detail
-
append
public IStringBuffer append(String str)
append a string to the buffer- Parameters:
str- string to append to
-
append
public IStringBuffer append(char[] chars, int start, int length)
append parts of the chars to the buffer- Parameters:
chars-start- the start indexlength- length of chars to append to
-
append
public IStringBuffer append(char[] chars, int start)
append the rest of the chars to the buffer- Parameters:
chars-start- the start index- Returns:
- IStringBuffer
-
append
public IStringBuffer append(char[] chars)
append some chars to the buffer- Parameters:
chars-
-
append
public IStringBuffer append(char c)
append a char to the buffer- Parameters:
c- the char to append to
-
append
public IStringBuffer append(boolean bool)
append a boolean value- Parameters:
bool-
-
append
public IStringBuffer append(short shortv)
append a short value- Parameters:
shortv-
-
append
public IStringBuffer append(int intv)
append a int value- Parameters:
intv-
-
append
public IStringBuffer append(long longv)
append a long value- Parameters:
longv-
-
append
public IStringBuffer append(float floatv)
append a float value- Parameters:
floatv-
-
append
public IStringBuffer append(double doublev)
append a double value- Parameters:
doublev-
-
length
public int length()
return the length of the buffer- Returns:
- int the length of the buffer
-
setLength
public int setLength(int length)
set the length of the buffer actually it just override the count and the actual buffer has nothing changed- Parameters:
length-
-
charAt
public char charAt(int idx)
get the char at a specified position in the buffer
-
last
public char last()
always return the last char- Returns:
- char
-
first
public char first()
always return the first char- Returns:
- char
-
deleteCharAt
public IStringBuffer deleteCharAt(int idx)
delete the char at the specified position
-
set
public void set(int idx, char chr)set the char at the specified index- Parameters:
idx-chr-
-
buffer
public char[] buffer()
return the chars of the buffer- Returns:
- char[]
-
clear
public IStringBuffer clear()
clear the buffer by reset the count to 0
-
toString
public String toString()
return the string of the current buffer- Overrides:
toStringin classObject- Returns:
- String
- See Also:
Object.toString()
-
-