|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cocoon.components.serializers.util.EncodingSerializer
public abstract class EncodingSerializer
An abstract serializer supporting multiple encodings.
This serializer is reusable. Inbetween uses,recycle()
should be
called, folled by setup(HttpServletRequest)
when starting a new serialization.
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 static String |
CONTENT_LIST_ATTRIBUTE
|
protected int |
indentPerLevel
Per level indent spaces |
static String |
NAMESPACE
|
protected Namespaces |
namespaces
The Namespace associated with this instance. |
protected HttpServletRequest |
request
|
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 |
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. |
static void |
include(String content,
HttpServletRequest request,
ContentHandler handler)
Add the content to the output without sending it through the pipeline. |
void |
recycle()
Reset this EncodingSerializer . |
void |
setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events. |
void |
setEncoding(String encoding)
|
void |
setIndentPerLevel(int i)
|
void |
setOutputStream(OutputStream out)
Set the OutputStream where this serializer will
write data to. |
void |
setup(HttpServletRequest request)
|
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 |
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
protected HttpServletRequest request
protected static final String CONTENT_LIST_ATTRIBUTE
public static final String NAMESPACE
Constructor Detail |
---|
protected EncodingSerializer(Encoder encoder)
EncodingSerializer
Method Detail |
---|
public void setup(HttpServletRequest request)
public static void include(String content, HttpServletRequest request, ContentHandler handler) throws SAXException
content
- request
- handler
-
SAXException
public void recycle()
EncodingSerializer
.
public void setOutputStream(OutputStream out) throws IOException
OutputStream
where this serializer will
write data to.
out
- The OutputStream
used for output.
IOException
public void setEncoding(String encoding) throws UnsupportedEncodingException
UnsupportedEncodingException
public void setIndentPerLevel(int i)
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
SAXException
public final void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
public String getPublicId()
getPublicId
in interface Locator
String
containing the public identifier,
or null if none is available.public String getSystemId()
getSystemId
in interface Locator
String
containing the system identifier,
or null if none is available.public int getLineNumber()
getLineNumber
in interface Locator
public int getColumnNumber()
getColumnNumber
in interface Locator
protected 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 ContentHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
SAXException
public void startElement(String nsuri, String local, String qual, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
SAXException
public void endElement(String nsuri, String local, String qual) throws SAXException
endElement
in interface ContentHandler
SAXException
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 |