|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sdsu.util.Stringizer
This class aids in creating parsable strings. This is useful in producing a ascii representations of objects. Strings produced via Stringizer can be parsed by SimpleTokenizer. A string contains tokens, comments, and separators. Comments start with the comment character and continue to the next newline (\n ) character. A token can be any object convertable to a string via toString(). If string representation of the token contains the separator, whitespace, or comment character it automatically quoted. Quote characters and escape characters in the string representation are automatically escaped (preceeded by the escape character. Whitespace characters are used only for quoting tokens. The separator given with the token is added to string only when the next token is appended.
SimpleTokenizer
Constructor Summary | |
Stringizer(int size,
TokenCharacters parser)
Create a Stringizer with initial room for size tokens |
|
Stringizer(TokenCharacters parser)
Create a Stringizer |
Method Summary | |
void |
appendComment(java.lang.String message)
Appends message as a comment at current location in string. |
void |
appendToken(java.lang.Object token,
char separator)
Appends token to the end of the string. |
void |
appendToken(java.lang.Object token,
java.lang.String separator)
Appends token to the end of the string. |
void |
setHeader(java.lang.String message)
Message is used as a comment at the begining of the string. |
java.lang.String |
toString()
Returns the string built up via the Stringizer. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Stringizer(TokenCharacters parser)
public Stringizer(int size, TokenCharacters parser)
commentChar
- character used to indicate start of a commentbeginQuoteChar
- character used to start a quote of a string containing special charactersendQuoteChar
- character used to end a quote of a string containing special charactersquotableChars
- characters that need to be quoted. Use null or empty string
for noneMethod Detail |
public void setHeader(java.lang.String message)
public void appendComment(java.lang.String message)
public void appendToken(java.lang.Object token, char separator)
public void appendToken(java.lang.Object token, java.lang.String separator)
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |