|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.attoparser.AbstractAttoParser
public abstract class AbstractAttoParser
Base abstract class for all IAttoParser
implementations, providing
common code for unifying all the supported document formats (String, char[],
char[] segment, Reader) into just one (Reader).
Subclasses of this class should only implement the abstract
parseDocument(Reader, IAttoHandler)
method.
Constructor Summary | |
---|---|
protected |
AbstractAttoParser()
|
Method Summary | |
---|---|
void |
parse(char[] document,
IAttoHandler handler)
Parse a document using the specified IAttoHandler . |
void |
parse(char[] document,
int offset,
int len,
IAttoHandler handler)
Parse a document using the specified IAttoHandler . |
void |
parse(Reader reader,
IAttoHandler handler)
Parse a document using the specified IAttoHandler . |
void |
parse(String document,
IAttoHandler handler)
Parse a document using the specified IAttoHandler . |
protected abstract void |
parseDocument(Reader reader,
IAttoHandler handler)
Parse the document, as a Reader . |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractAttoParser()
Method Detail |
---|
public final void parse(String document, IAttoHandler handler) throws AttoParseException
IAttoParser
Parse a document using the specified IAttoHandler
.
parse
in interface IAttoParser
document
- the document to be parsed, as a String.handler
- the handler to be used, an IAttoHandler
implementation.
AttoParseException
- if the document cannot be parsed.public final void parse(char[] document, IAttoHandler handler) throws AttoParseException
IAttoParser
Parse a document using the specified IAttoHandler
.
parse
in interface IAttoParser
document
- the document to be parsed, as a char[].handler
- the handler to be used, an IAttoHandler
implementation.
AttoParseException
- if the document cannot be parsed.public final void parse(char[] document, int offset, int len, IAttoHandler handler) throws AttoParseException
IAttoParser
Parse a document using the specified IAttoHandler
.
parse
in interface IAttoParser
document
- the document to be parsed, as a char[].offset
- the offset to be applied on the char[] document to determine the
start of the document contents.len
- the length (in chars) of the document stored in the char[].handler
- the handler to be used, an IAttoHandler
implementation.
AttoParseException
- if the document cannot be parsed.public final void parse(Reader reader, IAttoHandler handler) throws AttoParseException
IAttoParser
Parse a document using the specified IAttoHandler
.
Implementations of this interface must close the provided Reader
object after parsing.
parse
in interface IAttoParser
reader
- a Reader on the document.handler
- the handler to be used, an IAttoHandler
implementation.
AttoParseException
- if the document cannot be parsed.protected abstract void parseDocument(Reader reader, IAttoHandler handler) throws AttoParseException
Parse the document, as a Reader
.
This method is meant for overriding, and is the only parsing method that subclasses need to implement.
reader
- a Reader on the document.handler
- the handler to be used, an IAttoHandler
implementation.
AttoParseException
- if the document cannot be parsed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |