org.apache.abdera.util
Class AbstractParser

java.lang.Object
  extended by org.apache.abdera.util.AbstractParser
All Implemented Interfaces:
Parser
Direct Known Subclasses:
AbstractNamedParser

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

Abstract base implementation of Abdera Parser.


Field Summary
protected  Abdera abdera
           
protected  ParserOptions options
           
 
Constructor Summary
protected AbstractParser()
           
protected AbstractParser(Abdera abdera)
           
 
Method Summary
 Abdera getAbdera()
           
 ParserOptions getDefaultParserOptions()
          Return the default parser options for this Parser.
 Factory getFactory()
           
protected abstract  ParserOptions initDefaultParserOptions()
           
<T extends Element>
Document<T>
parse(java.io.InputStream in)
          Parse the input stream using the default character set encoding (UTF-8)
<T extends Element>
Document<T>
parse(java.io.InputStream in, java.lang.String base)
          Parse the input stream using the default character set encoding (UTF-8).
<T extends Element>
Document<T>
parse(java.io.InputStream in, java.lang.String base, ParserOptions options)
          Parse the input stream using using the specified Parse options.
<T extends Element>
Document<T>
parse(java.io.Reader in)
          Parse the reader using the default Base URI and options
<T extends Element>
Document<T>
parse(java.io.Reader in, java.lang.String base)
          Parse the reader using the specified Base URI
 void setDefaultParserOptions(ParserOptions options)
          Set the default parser options for this Parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.abdera.parser.Parser
parse
 

Field Detail

abdera

protected final Abdera abdera

options

protected ParserOptions options
Constructor Detail

AbstractParser

protected AbstractParser()

AbstractParser

protected AbstractParser(Abdera abdera)
Method Detail

getAbdera

public Abdera getAbdera()

getFactory

public Factory getFactory()

parse

public <T extends Element> Document<T> parse(java.io.InputStream in)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using the default character set encoding (UTF-8)

Specified by:
parse in interface Parser
Parameters:
in - The input stream to parse
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(java.io.InputStream in,
                                             java.lang.String base)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using the default character set encoding (UTF-8). The specified Base URI is used to resolve relative references contained in the document

Specified by:
parse in interface Parser
Parameters:
in - The input stream to parse
base - The Base URI of the document
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(java.io.InputStream in,
                                             java.lang.String base,
                                             ParserOptions options)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using using the specified Parse options. The parse options can be used to control various aspects of the parsing process such as the character set encoding to use and whether certain elements should be ignored. The specified Base URI is used to resolve relative references contained in the document.

Specified by:
parse in interface Parser
Parameters:
in - The input stream to parse
base - The Base URI of the document
options - The Parse Options
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(java.io.Reader in)
                                  throws ParseException
Description copied from interface: Parser
Parse the reader using the default Base URI and options

Specified by:
parse in interface Parser
Parameters:
in - The Reader to parse
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(java.io.Reader in,
                                             java.lang.String base)
                                  throws ParseException
Description copied from interface: Parser
Parse the reader using the specified Base URI

Specified by:
parse in interface Parser
Parameters:
in - The Reader to parse
base - The Base URI
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

getDefaultParserOptions

public ParserOptions getDefaultParserOptions()
Description copied from interface: Parser
Return the default parser options for this Parser. This method returns a copy of the default options. Changes to this instance will not affect the defaults returned by subsequent requests.

Specified by:
getDefaultParserOptions in interface Parser
Returns:
The default ParserOptions

initDefaultParserOptions

protected abstract ParserOptions initDefaultParserOptions()

setDefaultParserOptions

public void setDefaultParserOptions(ParserOptions options)
Description copied from interface: Parser
Set the default parser options for this Parser. This method copies the specified options.

Specified by:
setDefaultParserOptions in interface Parser
Parameters:
options - The Parser Options to use as the default