Class AbstractParser
java.lang.Object
com.mxgraph.util.svg.AbstractParser
- All Implemented Interfaces:
Parser
- Direct Known Subclasses:
NumberParser
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default resource bundle base name.protected intThe current character.protected ErrorHandlerThe error handler.protected NormalizingReaderThe normalizing reader. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateErrorMessage(String key, Object[] args) Returns a localized error message.protected abstract voiddoParse()Method responsible for actually parsing data after AbstractParser has initialized itself.protected StringReturns the resource bundle base name.intReturns the current character value.voidParses the given string.protected voidreportCharacterExpectedError(char expectedChar, int currentChar) simple api to call often reported error.protected voidreportError(String key, Object[] args) Signals an error to the error handler.protected voidreportUnexpectedCharacterError(int currentChar) simple api to call often reported error.voidsetErrorHandler(ErrorHandler handler) Allow an application to register an error event handler.protected voidSkips the whitespaces and an optional comma.protected voidSkips the whitespaces in the current reader.
-
Field Details
-
BUNDLE_CLASSNAME
-
errorHandler
The error handler. -
reader
The normalizing reader. -
current
protected int currentThe current character.
-
-
Constructor Details
-
AbstractParser
public AbstractParser()
-
-
Method Details
-
getCurrent
public int getCurrent()Returns the current character value. -
setErrorHandler
Allow an application to register an error event 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.
- Specified by:
setErrorHandlerin interfaceParser- Parameters:
handler- The error handler.
-
parse
Parses the given string.- Specified by:
parsein interfaceParser- Throws:
ParseException
-
doParse
Method responsible for actually parsing data after AbstractParser has initialized itself.- Throws:
ParseExceptionIOException
-
reportError
Signals an error to the error handler.- Parameters:
key- The message key in the resource bundle.args- The message arguments.- Throws:
ParseException
-
reportCharacterExpectedError
protected void reportCharacterExpectedError(char expectedChar, int currentChar) simple api to call often reported error. Just a wrapper for reportError().- Parameters:
expectedChar- what caller expectedcurrentChar- what caller found
-
reportUnexpectedCharacterError
protected void reportUnexpectedCharacterError(int currentChar) simple api to call often reported error. Just a wrapper for reportError().- Parameters:
currentChar- what the caller found and didnt expect
-
createErrorMessage
-
getBundleClassName
Returns the resource bundle base name.- Returns:
- BUNDLE_CLASSNAME.
-
skipSpaces
Skips the whitespaces in the current reader.- Throws:
IOException
-
skipCommaSpaces
Skips the whitespaces and an optional comma.- Throws:
IOException
-