|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.batik.parser.AbstractParser
This class is the superclass of all parsers. It provides localization and error handling methods.
Field Summary | |
protected char[] |
buffer
The buffer. |
static java.lang.String |
BUNDLE_CLASSNAME
The default resource bundle base name. |
protected int |
column
The current column. |
protected int |
count
The current count of characters in the buffer. |
protected int |
current
The current character. |
protected ErrorHandler |
errorHandler
The error handler. |
protected int |
line
The current line. |
protected LocalizableSupport |
localizableSupport
The localizable support. |
protected int |
position
The current position in the buffer. |
protected java.io.Reader |
reader
The reader. |
Constructor Summary | |
AbstractParser()
|
Method Summary | |
protected void |
collapseCRNL(int src,
int end)
|
protected java.lang.String |
createErrorMessage(java.lang.String key,
java.lang.Object[] args)
Returns a localized error message. |
protected abstract void |
doParse()
Method resposible for actually parsing data after AbstractParser has initialized it's self. |
protected boolean |
fillBuffer()
|
java.lang.String |
formatMessage(java.lang.String key,
java.lang.Object[] args)
Implements Localizable.formatMessage(String,Object[]) . |
protected java.lang.String |
getBundleClassName()
Returns the resource bundle base name. |
int |
getCurrent()
Returns the current character value. |
java.util.Locale |
getLocale()
Implements Localizable.getLocale() . |
void |
parse(java.io.Reader r)
Parses the given reader |
void |
parse(java.lang.String s)
Parses the given string. |
protected void |
read()
Reads one character from the given reader and sets 'current' to this value. |
protected void |
reportError(java.lang.String key,
java.lang.Object[] args)
Signals an error to the error handler. |
void |
setErrorHandler(ErrorHandler handler)
Allow an application to register an error event handler. |
void |
setLocale(java.util.Locale l)
Implements Localizable.setLocale(Locale) . |
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 java.lang.String BUNDLE_CLASSNAME
protected ErrorHandler errorHandler
protected LocalizableSupport localizableSupport
protected java.io.Reader reader
protected int line
protected int column
protected char[] buffer
protected int position
protected int count
protected int current
Constructor Detail |
public AbstractParser()
Method Detail |
public int getCurrent()
public void setLocale(java.util.Locale l)
Localizable.setLocale(Locale)
.setLocale
in interface Localizable
org.apache.batik.i18n.Localizable
l
- The locale to set.public java.util.Locale getLocale()
Localizable.getLocale()
.getLocale
in interface Localizable
public java.lang.String formatMessage(java.lang.String key, java.lang.Object[] args) throws java.util.MissingResourceException
Localizable.formatMessage(String,Object[])
.formatMessage
in interface Localizable
org.apache.batik.i18n.Localizable
key
- The key used to retreive the message from the resource
bundle.args
- The objects that compose the message.java.util.MissingResourceException
- if the key is not in the bundle.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(java.io.Reader r) throws ParseException
parse
in interface Parser
public void parse(java.lang.String s) throws ParseException
parse
in interface Parser
protected abstract void doParse() throws ParseException
protected final void collapseCRNL(int src, int end)
protected final boolean fillBuffer()
protected void read()
protected void reportError(java.lang.String key, java.lang.Object[] args) throws ParseException
key
- The message key in the resource bundle.args
- The message arguments.protected java.lang.String createErrorMessage(java.lang.String key, java.lang.Object[] args)
key
- The message key in the resource bundle.args
- The message arguments.protected java.lang.String getBundleClassName()
protected void skipSpaces()
protected void skipCommaSpaces()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |