|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.joost.emitter.StxEmitterBase
net.sf.joost.emitter.StreamEmitter
public abstract class StreamEmitter
Base class for emitter classes that produce a character stream.
Field Summary | |
---|---|
protected CharsetEncoder |
charsetEncoder
Encoder for the chosen encoding |
protected String |
encoding
The used output encoding |
private static String |
HTML_METHOD
Joost's HTML extension output method |
private static org.apache.commons.logging.Log |
log
|
protected Writer |
writer
Writer for the resulting text |
Fields inherited from interface net.sf.joost.Constants |
---|
DEBUG, DEFAULT_ENCODING, FEAT_NS, FEAT_NSPREFIX, FEATURE_URI_PREFIX, FUNC_NS, JOOST_EXT_NS, PR_ATTRIBUTES, PR_BUFFER, PR_CHILDREN, PR_CONTINUE, PR_ERROR, PR_SELF, PR_SIBLINGS, STX_NS |
Constructor Summary | |
---|---|
StreamEmitter(Writer writer,
String encoding)
|
Method Summary | |
---|---|
void |
comment(char[] ch,
int start,
int length)
Does nothing |
protected int |
encodeCharacters(char[] chars,
int index,
StringBuffer sb)
Encode a character from a character array, respect surrogate pairs |
void |
endCDATA()
Does nothing |
void |
endDTD()
Does nothing |
void |
endEntity(String name)
Won't be called |
void |
endPrefixMapping(String prefix)
Does nothing |
void |
ignorableWhitespace(char[] p0,
int p1,
int p2)
Won't be called |
static StreamEmitter |
newEmitter(OutputStream out,
Properties outputProperties)
Creates an emitter using a given OutputStream and a set
of output properties. |
static StreamEmitter |
newEmitter(String filename,
Properties outputProperties)
Creates an emitter that writes to a given file, using a set of output properties. |
static StreamEmitter |
newEmitter(Writer writer,
String encoding,
Properties outputProperties)
Creates an emitter using a given Writer , an output
encoding and a set of output properties. |
static StreamEmitter |
newXMLEmitter(Writer writer)
Creates an XML emitter using a given Writer and the default
output encoding (Constants.DEFAULT_ENCODING ). |
void |
processingInstruction(String target,
String data)
Does nothing |
void |
setDocumentLocator(Locator locator)
Does nothing |
void |
setOmitXmlDeclaration(boolean flag)
Defines whether the XML declaration should be omitted, default is false . |
void |
setSupportDisableOutputEscaping(boolean flag)
Defines whether disable-output-escaping will be supported (means whether the corresponding processing instructions Result.PI_DISABLE_OUTPUT_ESCAPING and
Result.PI_ENABLE_OUTPUT_ESCAPING will be interpreted). |
void |
skippedEntity(String value)
Won't be called |
void |
startCDATA()
Does nothing |
void |
startDTD(String name,
String publicId,
String systemId)
Does nothing |
void |
startEntity(String name)
Won't be called |
void |
startPrefixMapping(String prefix,
String uri)
Does nothing |
Methods inherited from class net.sf.joost.emitter.StxEmitterBase |
---|
getSystemId, setSystemId |
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 |
---|
characters, endDocument, endElement, startDocument, startElement |
Field Detail |
---|
private static org.apache.commons.logging.Log log
private static String HTML_METHOD
protected Writer writer
protected String encoding
protected CharsetEncoder charsetEncoder
encoding
Constructor Detail |
---|
public StreamEmitter(Writer writer, String encoding)
Method Detail |
---|
public static StreamEmitter newEmitter(Writer writer, String encoding, Properties outputProperties)
Writer
, an output
encoding and a set of output properties. The value of the
OutputKeys.METHOD
property determines the returned
emitter object.
writer
- A Writer
for receiving the output.encoding
- the encoding used in the writer resp. that should
be used for the encoding declarationoutputProperties
- The set of output properties to be used.
public static StreamEmitter newEmitter(OutputStream out, Properties outputProperties) throws UnsupportedEncodingException
OutputStream
and a set
of output properties. The value of the OutputKeys.ENCODING
property defines the encoding for to used. The value of the
OutputKeys.METHOD
property determines the returned
emitter object.
out
- An OutputStream
for receiving the output.outputProperties
- The set of output properties to be used.
UnsupportedEncodingException
- When outputProperties
specifies an unsupported output encodingpublic static StreamEmitter newXMLEmitter(Writer writer)
Writer
and the default
output encoding (Constants.DEFAULT_ENCODING
).
writer
- A Writer
for receiving the output.
public static StreamEmitter newEmitter(String filename, Properties outputProperties) throws IOException
OutputKeys.ENCODING
property defines the encoding for to used. The value of the
OutputKeys.METHOD
property determines the returned
emitter object.
filename
- The name of the output file.outputProperties
- The set of output properties to be used.
IOException
- When an error occurs while opening the file.public void setOmitXmlDeclaration(boolean flag)
false
.
flag
- true
: the XML declaration will be omitted;
false
: the XML declaration will be outputpublic void setSupportDisableOutputEscaping(boolean flag)
Result.PI_DISABLE_OUTPUT_ESCAPING
and
Result.PI_ENABLE_OUTPUT_ESCAPING
will be interpreted).
The default is false
flag
- true
the PIs will be interpreted;
false
the PIs will be written literallyprotected int encodeCharacters(char[] chars, int index, StringBuffer sb) throws SAXException
chars
- the character arrayindex
- the current indexsb
- the buffer to append the encoded character
SAXException
- when there's no low surrogatepublic void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
SAXException
public void endPrefixMapping(String prefix)
endPrefixMapping
in interface ContentHandler
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
SAXException
public void skippedEntity(String value)
skippedEntity
in interface ContentHandler
public void ignorableWhitespace(char[] p0, int p1, int p2)
ignorableWhitespace
in interface ContentHandler
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
public void startDTD(String name, String publicId, String systemId) throws SAXException
startDTD
in interface LexicalHandler
SAXException
public void endDTD()
endDTD
in interface LexicalHandler
public void startEntity(String name)
startEntity
in interface LexicalHandler
public void endEntity(String name)
endEntity
in interface LexicalHandler
public void startCDATA() throws SAXException
startCDATA
in interface LexicalHandler
SAXException
public void endCDATA() throws SAXException
endCDATA
in interface LexicalHandler
SAXException
public void comment(char[] ch, int start, int length) throws SAXException
comment
in interface LexicalHandler
SAXException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |