|
mxGraph 2.3.0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mxgraph.util.svg.AbstractParser
public abstract class AbstractParser
This class is the superclass of all parsers. It provides localization and error handling methods.
Field Summary | |
---|---|
static String |
BUNDLE_CLASSNAME
The default resource bundle base name. |
protected int |
current
The current character. |
protected ErrorHandler |
errorHandler
The error handler. |
protected NormalizingReader |
reader
The normalizing reader. |
Constructor Summary | |
---|---|
AbstractParser()
|
Method Summary | |
---|---|
protected String |
createErrorMessage(String key,
Object[] args)
Returns a localized error message. |
protected abstract void |
doParse()
Method responsible for actually parsing data after AbstractParser has initialized itself. |
protected String |
getBundleClassName()
Returns the resource bundle base name. |
int |
getCurrent()
Returns the current character value. |
void |
parse(String s)
Parses the given string. |
protected void |
reportCharacterExpectedError(char expectedChar,
int currentChar)
simple api to call often reported error. |
protected void |
reportError(String key,
Object[] args)
Signals an error to the error handler. |
protected void |
reportUnexpectedCharacterError(int currentChar)
simple api to call often reported error. |
void |
setErrorHandler(ErrorHandler handler)
Allow an application to register an error event handler. |
protected void |
skipCommaSpaces()
Skips the whitespaces and an optional comma. |
protected void |
skipSpaces()
Skips the whitespaces in the current reader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String BUNDLE_CLASSNAME
protected ErrorHandler errorHandler
protected NormalizingReader reader
protected int current
Constructor Detail |
---|
public AbstractParser()
Method Detail |
---|
public int getCurrent()
public void setErrorHandler(ErrorHandler handler)
If the application does not register an error event handler, all error events reported by the parser will cause an exception to be thrown.
Applications may register a new or different handler in the middle of a parse, and the parser must begin using the new handler immediately.
setErrorHandler
in interface Parser
handler
- The error handler.public void parse(String s) throws ParseException
parse
in interface Parser
ParseException
protected abstract void doParse() throws ParseException, IOException
ParseException
IOException
protected void reportError(String key, Object[] args) throws ParseException
key
- The message key in the resource bundle.args
- The message arguments.
ParseException
protected void reportCharacterExpectedError(char expectedChar, int currentChar)
expectedChar
- what caller expectedcurrentChar
- what caller foundprotected void reportUnexpectedCharacterError(int currentChar)
currentChar
- what the caller found and didnt expectprotected String createErrorMessage(String key, Object[] args)
key
- The message key in the resource bundle.args
- The message arguments.protected String getBundleClassName()
protected void skipSpaces() throws IOException
IOException
protected void skipCommaSpaces() throws IOException
IOException
|
mxGraph 2.3.0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |