|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.attoparser.AbstractAttoParser org.attoparser.AbstractBufferedAttoParser
public abstract class AbstractBufferedAttoParser
Base abstract class for IAttoParser
implementations reading
the parsed document using a buffer.
Subclasses of this abstract class should only implement the abstract
parseBuffer(char[], int, int, IAttoHandler, int, int)
method.
This class closes the document Reader
provided after parsing.
Nested Class Summary | |
---|---|
static class |
AbstractBufferedAttoParser.BufferParseResult
This class encapsulates the results of parsing a fragment (a buffer) of a document. |
Field Summary | |
---|---|
static int |
BUFFER_SIZE
Default buffer size to be used (buffer size will grow at runtime if an artifact (structure or text) is bigger than the whole buffer). |
Constructor Summary | |
---|---|
protected |
AbstractBufferedAttoParser()
|
Method Summary | |
---|---|
protected abstract AbstractBufferedAttoParser.BufferParseResult |
parseBuffer(char[] buffer,
int offset,
int len,
IAttoHandler handler,
int line,
int col)
Parse a buffer segment and return a AbstractBufferedAttoParser.BufferParseResult reporting
the results of this parsing. |
protected void |
parseDocument(Reader reader,
IAttoHandler handler)
Parse the document, as a Reader . |
Methods inherited from class org.attoparser.AbstractAttoParser |
---|
parse, parse, parse, parse |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUFFER_SIZE
Default buffer size to be used (buffer size will grow at runtime if an artifact (structure or text) is bigger than the whole buffer). Value: 4096 chars.
Constructor Detail |
---|
protected AbstractBufferedAttoParser()
Method Detail |
---|
protected final void parseDocument(Reader reader, IAttoHandler handler) throws AttoParseException
AbstractAttoParser
Parse the document, as a Reader
.
This method is meant for overriding, and is the only parsing method that subclasses need to implement.
parseDocument
in class AbstractAttoParser
reader
- a Reader on the document.handler
- the handler to be used, an IAttoHandler
implementation.
AttoParseException
- if the document cannot be parsed.protected abstract AbstractBufferedAttoParser.BufferParseResult parseBuffer(char[] buffer, int offset, int len, IAttoHandler handler, int line, int col) throws AttoParseException
Parse a buffer segment and return a AbstractBufferedAttoParser.BufferParseResult
reporting
the results of this parsing.
buffer
- the document buffer.offset
- the offset (in the document buffer) of the segment to be parsed.len
- the length (in chars) of the segment to be parsed.handler
- the IAttoHandler
implementation to be used for reporting events.line
- the line of the first position (offset) in buffer.col
- the column of the first position (offset) in buffer.
AbstractBufferedAttoParser.BufferParseResult
reporting the parsing status.
AttoParseException
- if an error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |