public class SAXBuffer extends Object implements ContentHandler, LexicalHandler, Serializable
Compared to the old Cocoon.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.
| Modifier and Type | Class and Description |
|---|---|
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 |
| Constructor and Description |
|---|
SAXBuffer()
Creates empty SaxBuffer
|
SAXBuffer(List<org.apache.cocoon.xml.sax.SAXBuffer.SaxBit> bits)
Creates SaxBuffer based on the provided bits list.
|
SAXBuffer(SAXBuffer saxBuffer)
Creates copy of another SaxBuffer
|
| Modifier and Type | Method and Description |
|---|---|
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<org.apache.cocoon.xml.sax.SAXBuffer.SaxBit> |
getBits() |
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
boolean |
isEmpty() |
void |
processingInstruction(String target,
String data) |
void |
recycle()
Clear this buffer
|
void |
saxBuffer(SAXBuffer xml)
Add a another 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() |
public SAXBuffer()
public SAXBuffer(List<org.apache.cocoon.xml.sax.SAXBuffer.SaxBit> bits)
public SAXBuffer(SAXBuffer saxBuffer)
public void skippedEntity(String name) throws SAXException
skippedEntity in interface ContentHandlerSAXExceptionpublic void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlerpublic void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerSAXExceptionpublic void processingInstruction(String target, String data) throws SAXException
processingInstruction in interface ContentHandlerSAXExceptionpublic void startDocument()
throws SAXException
startDocument in interface ContentHandlerSAXExceptionpublic void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement in interface ContentHandlerSAXExceptionpublic void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping in interface ContentHandlerSAXExceptionpublic void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlerSAXExceptionpublic void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement in interface ContentHandlerSAXExceptionpublic void endDocument()
throws SAXException
endDocument in interface ContentHandlerSAXExceptionpublic void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping in interface ContentHandlerSAXExceptionpublic void endCDATA()
throws SAXException
endCDATA in interface LexicalHandlerSAXExceptionpublic void comment(char[] ch,
int start,
int length)
throws SAXException
comment in interface LexicalHandlerSAXExceptionpublic void startEntity(String name) throws SAXException
startEntity in interface LexicalHandlerSAXExceptionpublic void endDTD()
throws SAXException
endDTD in interface LexicalHandlerSAXExceptionpublic void startDTD(String name, String publicId, String systemId) throws SAXException
startDTD in interface LexicalHandlerSAXExceptionpublic void startCDATA()
throws SAXException
startCDATA in interface LexicalHandlerSAXExceptionpublic void endEntity(String name) throws SAXException
endEntity in interface LexicalHandlerSAXExceptionpublic void saxBuffer(SAXBuffer xml)
public boolean isEmpty()
public List<org.apache.cocoon.xml.sax.SAXBuffer.SaxBit> getBits()
public void toSAX(ContentHandler contentHandler) throws SAXException
SAXExceptionpublic String toString()
public void recycle()
public void dump(Writer writer) throws IOException
IOExceptionCopyright © 2010 - 2020 Adobe. All Rights Reserved