|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.simpleframework.util.parse.ParseBuffer
public class ParseBuffer
This is primarily used to replace the StringBuffer
class, as a way for the Parser to store the char's
for a specific region within the parse data that constitutes a
desired value. The methods are not synchronized so it enables
the char's to be taken quicker than the
StringBuffer class.
| Field Summary | |
|---|---|
protected char[] |
buf
The char's this buffer accumulated. |
protected String |
cache
This is used to quicken toString. |
protected int |
count
This is the number of char's stored. |
| Constructor Summary | |
|---|---|
ParseBuffer()
Constructor for ParseBuffer. |
|
ParseBuffer(int size)
This creates a ParseBuffer with a specific
default size. |
|
| Method Summary | |
|---|---|
void |
append(char c)
This will add a char to the end of the buffer. |
void |
append(char[] c,
int off,
int len)
This will add a char to the end of the buffer. |
void |
append(ParseBuffer text)
This will add a ParseBuffer to the end of this. |
void |
append(ParseBuffer text,
int off,
int len)
This will add a ParseBuffer to the end of this. |
void |
append(String text)
This will add a String to the end of the buffer. |
void |
append(String str,
int off,
int len)
This will add a String to the end of the buffer. |
void |
clear()
This will empty the ParseBuffer so that the
toString parameter will return null. |
protected void |
ensureCapacity(int min)
This ensure that there is enough space in the buffer to allow for more char's to be added. |
int |
length()
This will return the number of bytes that have been appended to the ParseBuffer. |
void |
reset(ParseBuffer text)
This will reset the buffer in such a way that the buffer is cleared of all contents and then has the given string appended. |
void |
reset(String text)
This will reset the buffer in such a way that the buffer is cleared of all contents and then has the given string appended. |
String |
toString()
This will return the characters that have been appended to the ParseBuffer as a String object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String cache
toString.
protected char[] buf
char's this buffer accumulated.
protected int count
char's stored.
| Constructor Detail |
|---|
public ParseBuffer()
ParseBuffer. The default
ParseBuffer stores 16 char's
before a resize is needed to accommodate
extra characters.
public ParseBuffer(int size)
ParseBuffer with a specific
default size. The buffer will be created the with the
length specified. The ParseBuffer can grow
to accommodate a collection of char's larger
the the size specified.
size - initial size of this ParseBuffer| Method Detail |
|---|
public void append(char c)
char to the end of the buffer.
The buffer will not overflow with repeated uses of the
append, it uses an ensureCapacity
method which will allow the buffer to dynamically grow in
size to accommodate more char's.
c - the char to be appendedpublic void append(String text)
String to the end of the buffer.
The buffer will not overflow with repeated uses of the
append, it uses an ensureCapacity
method which will allow the buffer to dynamically grow in
size to accommodate large String objects.
text - the String to be appended to thispublic void reset(String text)
append(String) method for reference.
text - this is the text that is to be appended to thispublic void append(ParseBuffer text)
ParseBuffer to the end of this.
The buffer will not overflow with repeated uses of the
append, it uses an ensureCapacity
method which will allow the buffer to dynamically grow in
size to accommodate large ParseBuffer objects.
text - the ParseBuffer to be appendedpublic void reset(ParseBuffer text)
append(ParseBuffer) method for reference.
text - this is the text that is to be appended to this
public void append(char[] c,
int off,
int len)
char to the end of the buffer.
The buffer will not overflow with repeated uses of the
append, it uses an ensureCapacity
method which will allow the buffer to dynamically grow in
size to accommodate large char arrays.
c - the char array to be appended to thisoff - the read offset for the arraylen - the number of char's to add
public void append(String str,
int off,
int len)
String to the end of the buffer.
The buffer will not overflow with repeated uses of the
append, it uses an ensureCapacity
method which will allow the buffer to dynamically grow in
size to accommodate large String objects.
str - the String to be appended to thisoff - the read offset for the Stringlen - the number of char's to add
public void append(ParseBuffer text,
int off,
int len)
ParseBuffer to the end of this.
The buffer will not overflow with repeated uses of the
append, it uses an ensureCapacity
method which will allow the buffer to dynamically grow in
size to accommodate large ParseBuffer objects.
text - the ParseBuffer to be appendedoff - the read offset for the ParseBufferlen - the number of char's to addprotected void ensureCapacity(int min)
char's to be added. If
the buffer is already larger than min then the buffer
will not be expanded at all.
min - the minimum size neededpublic void clear()
ParseBuffer so that the
toString parameter will return null.
This is used so that the same ParseBuffer can be
recycled for different tokens.
public int length()
ParseBuffer. This will return zero after
the clear method has been invoked.
char's within the bufferpublic String toString()
ParseBuffer as a String object.
If the String object has been created before then
a cached String object will be returned. This
method will return null after clear is invoked.
toString in class Objectchar's appended as a String
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||