org.apache.cocoon.components.sax
Class AbstractXMLByteStreamInterpreter

java.lang.Object
  extended byorg.apache.cocoon.components.sax.AbstractXMLByteStreamInterpreter
All Implemented Interfaces:
XMLByteStreamConstants, org.apache.cocoon.xml.XMLProducer
Direct Known Subclasses:
XMLByteStreamInterpreter, XMLInputStreamInterpreter

public abstract class AbstractXMLByteStreamInterpreter
extends Object
implements org.apache.cocoon.xml.XMLProducer, XMLByteStreamConstants

This a simple xml compiler which takes a byte array as input. If you want to reuse this interpreter make sure to call first recycle() and then set the new consumer for the sax events.

Version:
$Id: AbstractXMLByteStreamInterpreter.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
protected  ContentHandler contentHandler
          The ContentHandler receiving SAX events.
protected static ContentHandler EMPTY_CONTENT_HANDLER
           
protected  LexicalHandler lexicalHandler
          The LexicalHandler receiving SAX events.
 
Fields inherited from interface org.apache.cocoon.components.sax.XMLByteStreamConstants
CHARACTERS, COMMENT, END_CDATA, END_DOCUMENT, END_DTD, END_ELEMENT, END_ENTITY, END_PREFIX_MAPPING, IGNORABLE_WHITESPACE, LOCATOR, PROCESSING_INSTRUCTION, SKIPPED_ENTITY, START_CDATA, START_DOCUMENT, START_DTD, START_ELEMENT, START_ENTITY, START_PREFIX_MAPPING
 
Constructor Summary
AbstractXMLByteStreamInterpreter()
           
 
Method Summary
protected  void parse()
          This method needs to be used by sub classes to start the parsing of the byte stream
protected abstract  int read()
           
protected abstract  int read(byte[] b)
           
protected  int readEvent()
           
 void recycle()
           
 void setConsumer(org.apache.cocoon.xml.XMLConsumer consumer)
          Set the XMLConsumer that will receive XML data.
 void setContentHandler(ContentHandler handler)
          Set the ContentHandler that will receive XML data.
 void setLexicalHandler(LexicalHandler handler)
          Set the LexicalHandler that will receive XML data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_CONTENT_HANDLER

protected static final ContentHandler EMPTY_CONTENT_HANDLER

contentHandler

protected ContentHandler contentHandler
The ContentHandler receiving SAX events.


lexicalHandler

protected LexicalHandler lexicalHandler
The LexicalHandler receiving SAX events.

Constructor Detail

AbstractXMLByteStreamInterpreter

public AbstractXMLByteStreamInterpreter()
Method Detail

setConsumer

public void setConsumer(org.apache.cocoon.xml.XMLConsumer consumer)
Set the XMLConsumer that will receive XML data.
This method will simply call setContentHandler(consumer) and setLexicalHandler(consumer).

Specified by:
setConsumer in interface org.apache.cocoon.xml.XMLProducer

setContentHandler

public void setContentHandler(ContentHandler handler)
Set the ContentHandler that will receive XML data.
Subclasses may retrieve this ContentHandler instance accessing the protected super.contentHandler field.


setLexicalHandler

public void setLexicalHandler(LexicalHandler handler)
Set the LexicalHandler that will receive XML data.
Subclasses may retrieve this LexicalHandler instance accessing the protected super.lexicalHandler field.


recycle

public void recycle()

parse

protected void parse()
              throws SAXException
This method needs to be used by sub classes to start the parsing of the byte stream

Throws:
SAXException

readEvent

protected int readEvent()
                 throws SAXException
Throws:
SAXException

read

protected abstract int read()
                     throws SAXException
Throws:
SAXException

read

protected abstract int read(byte[] b)
                     throws SAXException
Throws:
SAXException


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.