public class SAXBuffer
extends java.lang.Object
implements org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, java.io.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(java.util.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(java.io.Writer writer)
Dump buffer contents into the provided writer.
|
void |
endCDATA() |
void |
endDocument() |
void |
endDTD() |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName) |
void |
endEntity(java.lang.String name) |
void |
endPrefixMapping(java.lang.String prefix) |
java.util.List<org.apache.cocoon.xml.sax.SAXBuffer.SaxBit> |
getBits() |
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
boolean |
isEmpty() |
void |
processingInstruction(java.lang.String target,
java.lang.String data) |
void |
recycle()
Clear this buffer
|
void |
saxBuffer(SAXBuffer xml)
Add a another buffer
|
void |
setDocumentLocator(org.xml.sax.Locator locator) |
void |
skippedEntity(java.lang.String name) |
void |
startCDATA() |
void |
startDocument() |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId) |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts) |
void |
startEntity(java.lang.String name) |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri) |
void |
toSAX(org.xml.sax.ContentHandler contentHandler)
Stream this buffer into the provided content handler.
|
java.lang.String |
toString() |
public SAXBuffer()
public SAXBuffer(java.util.List<org.apache.cocoon.xml.sax.SAXBuffer.SaxBit> bits)
public SAXBuffer(SAXBuffer saxBuffer)
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
startEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void saxBuffer(SAXBuffer xml)
public boolean isEmpty()
public java.util.List<org.apache.cocoon.xml.sax.SAXBuffer.SaxBit> getBits()
public void toSAX(org.xml.sax.ContentHandler contentHandler) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public java.lang.String toString()
toString
in class java.lang.Object
public void recycle()
public void dump(java.io.Writer writer) throws java.io.IOException
java.io.IOException
Copyright © 2010 - 2020 Adobe. All Rights Reserved