|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.util.TokenBuilder
public final class TokenBuilder
This class serves as an efficient constructor for byte arrays.
It bears some resemblance to Java's StringBuilder
.
Field Summary | |
---|---|
byte[] |
chars
Character array. |
boolean |
ent
Entity flag. |
int |
size
Current token size. |
Constructor Summary | |
---|---|
TokenBuilder()
Empty constructor. |
|
TokenBuilder(byte[] str)
Constructor, specifying an initial array. |
|
TokenBuilder(int i)
Constructor, specifying an initial array size. |
|
TokenBuilder(java.lang.String str)
Constructor, specifying an initial string. |
Method Summary | |
---|---|
TokenBuilder |
add(byte b)
Adds a single character to the token. |
TokenBuilder |
add(byte[] b)
Adds a byte array to the token. |
void |
add(byte[] b,
int s,
int e)
Adds a partial byte array to the token. |
TokenBuilder |
add(char ch)
Adds a single character to the token. |
TokenBuilder |
add(int i)
Adds an integer to the token. |
void |
add(java.lang.Object str,
java.lang.Object... ext)
Replaces all % characters in the input string by the specified extension objects, which can be byte arrays or any other object. |
TokenBuilder |
add(java.lang.String s)
Adds a string to the token. |
void |
addUTF(int c)
Adds the specified UTF8 character. |
void |
chop()
Chops leading and trailing whitespaces. |
byte[] |
finish()
Returns the token as a byte array. |
void |
reset()
Resets the token buffer. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int size
public boolean ent
public byte[] chars
Constructor Detail |
---|
public TokenBuilder()
public TokenBuilder(int i)
i
- sizepublic TokenBuilder(java.lang.String str)
str
- initial stringpublic TokenBuilder(byte[] str)
str
- initial stringMethod Detail |
---|
public void reset()
public TokenBuilder add(char ch)
ch
- the character to be added
public TokenBuilder add(byte b)
b
- the character to be added
public void addUTF(int c)
c
- the character to be addedpublic TokenBuilder add(int i)
i
- the integer to be added
public TokenBuilder add(byte[] b)
b
- the character array to be added
public void add(byte[] b, int s, int e)
b
- the character array to be addeds
- start positione
- end positionpublic TokenBuilder add(java.lang.String s)
s
- the string to be added
public void add(java.lang.Object str, java.lang.Object... ext)
str
- query informationext
- text text extensionspublic void chop()
public byte[] finish()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |