|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nux.xom.io.StreamingSerializerFactory
public class StreamingSerializerFactory
Factory creating instances of StreamingSerializer
implementations.
Currently there are three implementations. One writes a standard textual XML
document via a thin layer on top of the normal XOM Serializer
.
Another writes a bnux binary XML document via a BinaryXMLCodec
.
Yet another delegates to an underlying StAX XMLStreamWriter
.
Future releases may include implementations that delegate to SAX and DOM.
Constructor Summary | |
---|---|
StreamingSerializerFactory()
Constructs a new factory instance; The serializer instances it creates can be reused serially, but are not thread safe. |
Method Summary | |
---|---|
StreamingSerializer |
createBinaryXMLSerializer(OutputStream out,
int zlibCompressionLevel)
Returns a new streaming serializer that writes bnux binary XML to the given underlying output stream, using the given ZLIB compression level. |
StreamingSerializer |
createStaxSerializer(XMLStreamWriter writer)
Returns a new streaming serializer that writes standard textual XML to the given underlying StAX XMLStreamWriter. |
StreamingSerializer |
createXMLSerializer(OutputStream out,
String encoding)
Returns a new streaming serializer that writes standard textual XML to the given underlying output stream, using the given character encoding for char to byte conversions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StreamingSerializerFactory()
Method Detail |
---|
public StreamingSerializer createBinaryXMLSerializer(OutputStream out, int zlibCompressionLevel)
An optional zlib compression level ranging from 0 (no ZLIB compression; best performance) to 1 (little ZLIB compression; reduced performance) to 9 (strongest ZLIB compression; worst performance) allows one to configure the CPU/memory consumption trade-off.
Unless there is a good reason to the contrary, you should always use level 0: the bnux algorithm typically already precompresses considerably.
out
- the underlying output stream to write tozlibCompressionLevel
- a number in the range 0..9
public StreamingSerializer createXMLSerializer(OutputStream out, String encoding)
The standard XOM Serializer
options are used, in
particular Serializer.setIndent(int)
with argument zero,
i.e. no extra indentation.
out
- the underlying stream to write toencoding
- the character encoding to use (e.g. "UTF-8")
Serializer.Serializer(OutputStream, String)
public StreamingSerializer createStaxSerializer(XMLStreamWriter writer)
In theory, any StAX implementation will work, but in practise Woodstox is the only StAX implementation known to be exceptionally conformant, reliable, complete and efficient.
The returned instance auto-suppresses redundant namespace declarations
irrespective of the underlying StAX implementation. Consequently, XML
output will be identical irrespective of the XMLStreamWriter's
namespace repairing mode
and javax.xml.stream.isPrefixDefaulting mode.
In other words, there's no need for a user to specify these modes, and
there's no need to change the default settings of the underlying StAX
implementation. The returned StreamingSerializer "does the right thing"
no matter what.
writer
- the underlying StAX XMLStreamWriter to write to
XMLOutputFactory
|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |