Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.batik.parser
Class AbstractParser  view AbstractParser download AbstractParser.java

java.lang.Object
  extended byorg.apache.batik.parser.AbstractParser
All Implemented Interfaces:
org.apache.batik.i18n.Localizable, Parser
Direct Known Subclasses:
LengthParser, NumberParser, PreserveAspectRatioParser

public abstract class AbstractParser
extends java.lang.Object
implements Parser

This class is the superclass of all parsers. It provides localization and error handling methods.

Version:
$Id: AbstractParser.java,v 1.10 2004/08/18 07:14:45 vhardy Exp $

Field Summary
static java.lang.String BUNDLE_CLASSNAME
          The default resource bundle base name.
protected  int current
          The current character.
protected  ErrorHandler errorHandler
          The error handler.
protected  org.apache.batik.i18n.LocalizableSupport localizableSupport
          The localizable support.
protected  org.apache.batik.util.io.NormalizingReader reader
          The normalizing reader.
 
Constructor Summary
AbstractParser()
           
 
Method Summary
protected  java.lang.String createErrorMessage(java.lang.String key, java.lang.Object[] args)
          Returns a localized error message.
protected abstract  void doParse()
          Method responsible for actually parsing data after AbstractParser has initialized itself.
 java.lang.String formatMessage(java.lang.String key, java.lang.Object[] args)
          Implements Localizable.formatMessage(String,Object[])>Localizable.formatMessage(String,Object[]) 55 .
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()>Localizable.getLocale() 55 .
 void parse(java.io.InputStream is, java.lang.String enc)
          Parses the given input stream.
 void parse(java.io.Reader r)
          Parses the given reader
 void parse(java.lang.String s)
          Parses the given string.
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)>Localizable.setLocale(Locale) 55 .
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

BUNDLE_CLASSNAME

public static final java.lang.String BUNDLE_CLASSNAME
The default resource bundle base name.

See Also:
Constant Field Values

errorHandler

protected ErrorHandler errorHandler
The error handler.


localizableSupport

protected org.apache.batik.i18n.LocalizableSupport localizableSupport
The localizable support.


reader

protected org.apache.batik.util.io.NormalizingReader reader
The normalizing reader.


current

protected int current
The current character.

Constructor Detail

AbstractParser

public AbstractParser()
Method Detail

getCurrent

public int getCurrent()
Returns the current character value.


setLocale

public void setLocale(java.util.Locale l)
Implements Localizable.setLocale(Locale)>Localizable.setLocale(Locale) 55 .

Specified by:
setLocale in interface org.apache.batik.i18n.Localizable

getLocale

public java.util.Locale getLocale()
Implements Localizable.getLocale()>Localizable.getLocale() 55 .

Specified by:
getLocale in interface org.apache.batik.i18n.Localizable

formatMessage

public java.lang.String formatMessage(java.lang.String key,
                                      java.lang.Object[] args)
                               throws java.util.MissingResourceException
Implements Localizable.formatMessage(String,Object[])>Localizable.formatMessage(String,Object[]) 55 .

Specified by:
formatMessage in interface org.apache.batik.i18n.Localizable

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
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:
setErrorHandler in interface Parser

parse

public void parse(java.io.Reader r)
           throws ParseException
Parses the given reader

Specified by:
parse in interface Parser

parse

public void parse(java.io.InputStream is,
                  java.lang.String enc)
           throws ParseException
Parses the given input stream. If the encoding is null, ISO-8859-1 is used.


parse

public void parse(java.lang.String s)
           throws ParseException
Parses the given string.

Specified by:
parse in interface Parser

doParse

protected abstract void doParse()
                         throws ParseException,
                                java.io.IOException
Method responsible for actually parsing data after AbstractParser has initialized itself.


reportError

protected void reportError(java.lang.String key,
                           java.lang.Object[] args)
                    throws ParseException
Signals an error to the error handler.


createErrorMessage

protected java.lang.String createErrorMessage(java.lang.String key,
                                              java.lang.Object[] args)
Returns a localized error message.


getBundleClassName

protected java.lang.String getBundleClassName()
Returns the resource bundle base name.


skipSpaces

protected void skipSpaces()
                   throws java.io.IOException
Skips the whitespaces in the current reader.


skipCommaSpaces

protected void skipCommaSpaces()
                        throws java.io.IOException
Skips the whitespaces and an optional comma.