|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.io.Writer
java.io.FilterWriter
org.apache.commons.xmlio.out.XMLWriter
org.apache.commons.xmlio.out.XMLOutputStreamWriter
Adds XML export functionality to the underlying output stream. Formatting and
encoding is done as straight forward as possible.
Everything you know better than this class must be done by you, e.g. you will
have to tell XMLOutputStreamWriter where you wish to have
newlines.In effect, no unexpected so called
intelligent behavior is to be feared. Another effect is high speed.
Caution: Do not forget to call FilterWriter.flush() at the end of your
exporting process as otherwise no data might be written.
Warning: When using two byte encoding (e.g. UTF-16) underlying
OutputStream can
not savely be brought to string. Do not use
ByteArrayOutputStream with two byte encoding, as XML declaration
will be in single byte encoding (according to XML spec) and the rest will be
in double byte totally confusing ByteArrayOutputStream encoding to string.
If you want to have string output use XMLWriter filtering
StringWriter or for convenience XMLStringWriter.
| Field Summary | |
static java.lang.String |
ENCODING_ISO_8859_1
Name of ISO-8859-1 encoding |
static java.lang.String |
ENCODING_ISO_LATIN1
Alias for ISO-8859-1 encoding |
static java.lang.String |
ENCODING_STANDARD
Name of standard encoding |
static java.lang.String |
ENCODING_UTF_16
Name of UTF-16 encoding |
static java.lang.String |
ENCODING_UTF_8
Name of UTF-8 encoding |
protected java.lang.String |
encodingName
|
protected java.io.OutputStream |
os
|
| Fields inherited from class org.apache.commons.xmlio.out.XMLWriter |
depth, indent, NEWLINE, nlAfterEmptyTag, nlAfterEndTag, nlAfterStartTag, NO_NEWLINE, prettyPrintMode, tabWidth, xmlDeclWritten |
| Fields inherited from class java.io.FilterWriter |
out |
| Fields inherited from class java.io.Writer |
lock |
| Constructor Summary | |
XMLOutputStreamWriter(java.io.OutputStream os)
Creates a new output stream writer for XML export. |
|
XMLOutputStreamWriter(java.io.OutputStream os,
java.lang.String encodingName)
Creates a new output stream writer for XML export. |
|
| Method Summary | |
java.lang.String |
getEncodingName()
Gets the name of the encoding as it would be inserted into the XML declaration. |
void |
writeXMLDeclaration()
Writes XML delcaration using version 1.0 and encoding specified in constructor. |
| Methods inherited from class java.io.FilterWriter |
close, flush, write, write, write |
| Methods inherited from class java.io.Writer |
write, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static java.lang.String ENCODING_UTF_8
public static java.lang.String ENCODING_UTF_16
public static java.lang.String ENCODING_ISO_8859_1
public static java.lang.String ENCODING_STANDARD
public static java.lang.String ENCODING_ISO_LATIN1
protected java.io.OutputStream os
protected java.lang.String encodingName
| Constructor Detail |
public XMLOutputStreamWriter(java.io.OutputStream os,
java.lang.String encodingName)
throws java.io.UnsupportedEncodingException
os - the underlying output stream the XML is exported toencodingName - name of the encoding used to write XML as well as
for the XML declataration (e.g. UTF-8, ISO-8859-1, ...)
public XMLOutputStreamWriter(java.io.OutputStream os)
throws java.io.UnsupportedEncodingException
ENCODING_STANDARD, which usually is
UTF-8.
os - the underlying output stream the XML is exported toXMLOutputStreamWriter(OutputStream, String)| Method Detail |
public java.lang.String getEncodingName()
OutputStreamWriter.getEncoding() may return something less verbose.
OutputStreamWriter.getEncoding()
public void writeXMLDeclaration()
throws java.io.IOException
writeXMLDeclaration in class XMLWriterjava.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||