|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.xml.AbstractSAXFragment
org.apache.cocoon.xml.SaxBuffer
public class SaxBuffer
A class that can record SAX events and replay them later.
Compared to XMLByteStreamCompiler,
this class is many times faster at sending out the recorded SAX events since
it doesn't need to convert between byte and char representations etc.
On the other hand, its data structure is more complex then a simple byte array,
making XMLByteStreamCompiler better in case the recorded SAX should be stored long-term.
Use this class if you need to frequently generate smaller amounts of SAX events, or replay a set of recorded start events immediately.
Both ContentHandler and LexicalHandler are supported, the only
exception is that the setDocumentLocator event is not recorded.
| Nested Class Summary | |
|---|---|
static class |
SaxBuffer.Characters
|
static class |
SaxBuffer.Comment
|
static class |
SaxBuffer.EndCDATA
|
static class |
SaxBuffer.EndDocument
|
static class |
SaxBuffer.EndDTD
|
static class |
SaxBuffer.EndElement
|
static class |
SaxBuffer.EndEntity
|
static class |
SaxBuffer.EndPrefixMapping
|
static class |
SaxBuffer.IgnorableWhitespace
|
static class |
SaxBuffer.PI
|
static class |
SaxBuffer.SkippedEntity
|
static class |
SaxBuffer.StartCDATA
|
static class |
SaxBuffer.StartDocument
|
static class |
SaxBuffer.StartDTD
|
static class |
SaxBuffer.StartElement
|
static class |
SaxBuffer.StartEntity
|
static class |
SaxBuffer.StartPrefixMapping
|
static class |
SaxBuffer.XMLizableBit
|
| Field Summary | |
|---|---|
protected List |
saxbits
Stores list of SaxBit objects. |
| Constructor Summary | |
|---|---|
SaxBuffer()
Creates empty SaxBuffer |
|
SaxBuffer(List bits)
Creates SaxBuffer based on the provided bits list. |
|
SaxBuffer(SaxBuffer saxBuffer)
Creates copy of another SaxBuffer |
|
| Method Summary | |
|---|---|
protected void |
addBit(org.apache.cocoon.xml.SaxBuffer.SaxBit bit)
Adds a SaxBit to the bits list |
protected Iterator |
bits()
Iterates through the bits list |
void |
characters(char[] ch,
int start,
int length)
|
void |
comment(char[] ch,
int start,
int length)
|
void |
dump(Writer writer)
Dump buffer contents into the provided writer. |
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(String namespaceURI,
String localName,
String qName)
|
void |
endEntity(String name)
|
void |
endPrefixMapping(String prefix)
|
List |
getBits()
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
boolean |
isEmpty()
|
void |
processingInstruction(String target,
String data)
|
void |
recycle()
Clear this buffer |
void |
setDocumentLocator(Locator locator)
|
void |
skippedEntity(String name)
|
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(String name,
String publicId,
String systemId)
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
|
void |
startEntity(String name)
|
void |
startPrefixMapping(String prefix,
String uri)
|
void |
toSAX(ContentHandler contentHandler)
Stream this buffer into the provided content handler. |
String |
toString()
|
void |
xmlizable(XMLizable xml)
Add a bit containing XMLizable object |
| Methods inherited from class org.apache.cocoon.xml.AbstractSAXFragment |
|---|
toDOM |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected List saxbits
SaxBit objects.
| Constructor Detail |
|---|
public SaxBuffer()
public SaxBuffer(List bits)
public SaxBuffer(SaxBuffer saxBuffer)
| Method Detail |
|---|
public void skippedEntity(String name)
throws SAXException
skippedEntity in interface ContentHandlerSAXExceptionpublic void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandler
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerSAXException
public void processingInstruction(String target,
String data)
throws SAXException
processingInstruction in interface ContentHandlerSAXException
public void startDocument()
throws SAXException
startDocument in interface ContentHandlerSAXException
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException
startElement in interface ContentHandlerSAXException
public void endPrefixMapping(String prefix)
throws SAXException
endPrefixMapping in interface ContentHandlerSAXException
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlerSAXException
public void endElement(String namespaceURI,
String localName,
String qName)
throws SAXException
endElement in interface ContentHandlerSAXException
public void endDocument()
throws SAXException
endDocument in interface ContentHandlerSAXException
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
startPrefixMapping in interface ContentHandlerSAXException
public void endCDATA()
throws SAXException
endCDATA in interface LexicalHandlerSAXException
public void comment(char[] ch,
int start,
int length)
throws SAXException
comment in interface LexicalHandlerSAXException
public void startEntity(String name)
throws SAXException
startEntity in interface LexicalHandlerSAXException
public void endDTD()
throws SAXException
endDTD in interface LexicalHandlerSAXException
public void startDTD(String name,
String publicId,
String systemId)
throws SAXException
startDTD in interface LexicalHandlerSAXException
public void startCDATA()
throws SAXException
startCDATA in interface LexicalHandlerSAXException
public void endEntity(String name)
throws SAXException
endEntity in interface LexicalHandlerSAXExceptionpublic void xmlizable(XMLizable xml)
public boolean isEmpty()
public List getBits()
public void toSAX(ContentHandler contentHandler)
throws SAXException
toSAX in interface XMLizableSAXExceptionpublic String toString()
toString in class Objectpublic void recycle()
recycle in interface Recyclable
public void dump(Writer writer)
throws IOException
IOExceptionprotected final void addBit(org.apache.cocoon.xml.SaxBuffer.SaxBit bit)
protected final Iterator bits()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||