|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.components.serializers.EncodingSerializer
public abstract class EncodingSerializer
An abstract serializer supporting multiple encodings.
This serializer can accept the following configuration whenever it is declared into a sitemap:
<serializer class="org.apache.cocoon.components.serializers..." ... > <encoding>myencoding</encoding> <indent>myindenting</indent> <setContentLength>false</setContentLength> </serializer>
The value indicated by myencoding must be replaced with a valid
charset encoding (this serializer does not rely on the JVM for character
encoding, you can look into the cocoon-serializers-charsets
JAR file for a list).
The value indicated by myindenting will control the indenting level for each element.
The value indicated by setContentLength determines if the serializer
sets the Content-Length HTTP header. The parameter is optional, the
default value is false.
| Field Summary | |
|---|---|
static int |
ATTRIBUTE_LENGTH
The length of the array of strings representing an attribute. |
static int |
ATTRIBUTE_LOCAL
The position of the local name in the attributes array. |
static int |
ATTRIBUTE_NSURI
The position of the namespace URI in the attributes array. |
static int |
ATTRIBUTE_QNAME
The position of the qualified name in the attributes array. |
static int |
ATTRIBUTE_VALUE
The position of the value in the attributes array. |
protected Charset |
charset
The Charset associated with the character encoding. |
protected int |
indentPerLevel
Per level indent spaces |
protected Namespaces |
namespaces
The Namespace associated with this instance. |
| Fields inherited from interface org.apache.cocoon.serialization.Serializer |
|---|
ROLE |
| Constructor Summary | |
|---|---|
protected |
EncodingSerializer(Encoder encoder)
Create a new instance of this EncodingSerializer |
| Method Summary | |
|---|---|
abstract void |
body(String uri,
String local,
String qual)
Receive notification of the beginning of the document body. |
void |
characters(char[] ch,
int start,
int length)
|
abstract void |
charactersImpl(char[] ch,
int start,
int length)
Receive character notifications |
void |
configure(Configuration conf)
Set the configurations for this serializer. |
protected void |
encode(char[] data)
Encode and write an array of characters. |
protected void |
encode(char[] data,
int start,
int length)
Encode and write a specific part of an array of characters. |
protected void |
encode(String data)
Encode and write a String |
void |
endDocument()
Receive notification of the end of a document. |
void |
endElement(String nsuri,
String local,
String qual)
Receive notification of the end of an element. |
abstract void |
endElementImpl(String uri,
String local,
String qual)
Receive notification of the end of an element. |
void |
endPrefixMapping(String prefix)
End the scope of a prefix-URI mapping. |
protected void |
flush()
Flush the stream. |
int |
getColumnNumber()
Return the column number where the current document event ends. |
int |
getLineNumber()
Return the line number where the current document event ends. |
protected String |
getLocation()
Return a String describing the current location. |
String |
getPublicId()
Return the public identifier for the current document event. |
String |
getSystemId()
Return the system identifier for the current document event. |
void |
recycle()
Reset this EncodingSerializer. |
void |
setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events. |
void |
setOutputStream(OutputStream out)
Set the OutputStream where this serializer will
write data to. |
boolean |
shouldSetContentLength()
Test if the component wants to set the content length. |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startElement(String nsuri,
String local,
String qual,
Attributes attributes)
Receive notification of the beginning of an element. |
abstract void |
startElementImpl(String uri,
String local,
String qual,
String[][] namespaces,
String[][] attributes)
Receive notification of the beginning of an element. |
void |
startPrefixMapping(String prefix,
String uri)
Begin the scope of a prefix-URI Namespace mapping. |
protected void |
write(char[] data)
Write an array of characters. |
protected void |
write(char[] data,
int start,
int length)
Write a portion of an array of characters. |
protected void |
write(int c)
Write a single character. |
protected void |
write(String data)
Write a string. |
protected void |
write(String data,
int start,
int length)
Write a portion of a string. |
protected void |
writeIndent(int indent)
Write out character to indent the output according to the level of nesting |
protected void |
writeln()
Write a end-of-line character. |
protected void |
writeln(String data)
Write a string and a end-of-line character. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.xml.sax.ContentHandler |
|---|
ignorableWhitespace, processingInstruction, skippedEntity |
| Methods inherited from interface org.xml.sax.ext.LexicalHandler |
|---|
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity |
| Methods inherited from interface org.apache.cocoon.sitemap.SitemapOutputComponent |
|---|
getMimeType |
| Field Detail |
|---|
public static final int ATTRIBUTE_NSURI
public static final int ATTRIBUTE_LOCAL
public static final int ATTRIBUTE_QNAME
public static final int ATTRIBUTE_VALUE
public static final int ATTRIBUTE_LENGTH
protected Charset charset
Charset associated with the character encoding.
protected Namespaces namespaces
Namespace associated with this instance.
protected int indentPerLevel
| Constructor Detail |
|---|
protected EncodingSerializer(Encoder encoder)
EncodingSerializer
| Method Detail |
|---|
public boolean shouldSetContentLength()
shouldSetContentLength in interface SitemapOutputComponentpublic void recycle()
EncodingSerializer.
recycle in interface Recyclable
public void setOutputStream(OutputStream out)
throws IOException
OutputStream where this serializer will
write data to.
setOutputStream in interface SitemapOutputComponentout - The OutputStream used for output.
IOException
public void configure(Configuration conf)
throws ConfigurationException
configure in interface ConfigurableConfigurationException
protected void encode(String data)
throws SAXException
String
SAXException
protected void encode(char[] data)
throws SAXException
SAXException
protected void encode(char[] data,
int start,
int length)
throws SAXException
SAXExceptionpublic final void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlerpublic String getPublicId()
getPublicId in interface LocatorString containing the public identifier,
or null if none is available.public String getSystemId()
getSystemId in interface LocatorString containing the system identifier,
or null if none is available.public int getLineNumber()
getLineNumber in interface Locatorpublic int getColumnNumber()
getColumnNumber in interface Locatorprotected String getLocation()
String describing the current location.
protected void flush()
throws SAXException
SAXException
protected void write(char[] data)
throws SAXException
SAXException
protected void write(char[] data,
int start,
int length)
throws SAXException
SAXException
protected void write(int c)
throws SAXException
SAXException
protected void write(String data)
throws SAXException
SAXException
protected void write(String data,
int start,
int length)
throws SAXException
SAXException
protected void writeln()
throws SAXException
SAXException
protected void writeln(String data)
throws SAXException
SAXException
protected void writeIndent(int indent)
throws SAXException
indent -
SAXException
public void startDocument()
throws SAXException
startDocument 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 endPrefixMapping(String prefix)
throws SAXException
endPrefixMapping in interface ContentHandlerSAXException
public void startElement(String nsuri,
String local,
String qual,
Attributes attributes)
throws SAXException
startElement in interface ContentHandlerSAXException
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlerSAXException
public void endElement(String nsuri,
String local,
String qual)
throws SAXException
endElement in interface ContentHandlerSAXException
public abstract void body(String uri,
String local,
String qual)
throws SAXException
uri - The namespace URI of the root element.local - The local name of the root element.qual - The fully-qualified name of the root element.
SAXException
public abstract void startElementImpl(String uri,
String local,
String qual,
String[][] namespaces,
String[][] attributes)
throws SAXException
uri - The namespace URI of the root element.local - The local name of the root element.qual - The fully-qualified name of the root element.namespaces - An array of String objects containing
the namespaces to be declared by this element.attributes - An array of String objects containing
all attributes of this element.
SAXException
public abstract void charactersImpl(char[] ch,
int start,
int length)
throws SAXException
ch - start - length -
SAXException
public abstract void endElementImpl(String uri,
String local,
String qual)
throws SAXException
uri - The namespace URI of the root element.local - The local name of the root element.qual - The fully-qualified name of the root element.
SAXException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||