Package com.sun.xml.ws.api.streaming
Class XMLStreamWriterFactory
- java.lang.Object
-
- com.sun.xml.ws.api.streaming.XMLStreamWriterFactory
-
- Direct Known Subclasses:
XMLStreamWriterFactory.Default
,XMLStreamWriterFactory.NoLock
,XMLStreamWriterFactory.Zephyr
public abstract class XMLStreamWriterFactory extends Object
Factory forXMLStreamWriter
.This wraps
XMLOutputFactory
and allows us to reuseXMLStreamWriter
instances when appropriate.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XMLStreamWriterFactory.Default
DefaultXMLStreamWriterFactory
implementation that can work with anyXMLOutputFactory
.static class
XMLStreamWriterFactory.HasEncodingWriter
static class
XMLStreamWriterFactory.NoLock
ForXMLOutputFactory
is thread safe.static interface
XMLStreamWriterFactory.RecycleAware
Interface that can be implemented byXMLStreamWriter
to be notified when it's recycled.static class
XMLStreamWriterFactory.Zephyr
XMLStreamWriterFactory
implementation for Sun's StaX implementation.
-
Constructor Summary
Constructors Constructor Description XMLStreamWriterFactory()
-
Method Summary
-
-
-
Method Detail
-
doCreate
public abstract XMLStreamWriter doCreate(OutputStream out)
Seecreate(OutputStream)
for the contract. This method may be invoked concurrently.
-
doCreate
public abstract XMLStreamWriter doCreate(OutputStream out, String encoding)
Seecreate(OutputStream,String)
for the contract. This method may be invoked concurrently.
-
doRecycle
public abstract void doRecycle(XMLStreamWriter r)
Seerecycle(XMLStreamWriter)
for the contract. This method may be invoked concurrently.
-
recycle
public static void recycle(XMLStreamWriter r)
Should be invoked when the code finished using anXMLStreamWriter
.If the recycled instance implements
XMLStreamWriterFactory.RecycleAware
,XMLStreamWriterFactory.RecycleAware.onRecycled()
will be invoked to let the instance know that it's being recycled.It is not a hard requirement to call this method on every
XMLStreamReader
instance. Not doing so just reduces the performance by throwing away possibly reusable instances. So the caller should always consider the effort it takes to recycle vs the possible performance gain by doing so.This method may be invked by multiple threads concurrently.
- Parameters:
r
- TheXMLStreamReader
instance that the caller finished using. This could be anyXMLStreamReader
implementation, not just the ones that were created from this factory. So the implementation of this class needs to be aware of that.
-
get
@NotNull public static XMLStreamWriterFactory get()
Gets the singleton instance.
-
set
public static void set(@NotNull XMLStreamWriterFactory f)
Overrides the singletonXMLStreamWriterFactory
instance that the JAX-WS RI uses.- Parameters:
f
- must not be null.
-
create
public static XMLStreamWriter create(OutputStream out)
Short-cut forcreate(OutputStream, String)
with UTF-8.
-
create
public static XMLStreamWriter create(OutputStream out, String encoding)
-
createXMLStreamWriter
public static XMLStreamWriter createXMLStreamWriter(OutputStream out)
Deprecated.
-
createXMLStreamWriter
public static XMLStreamWriter createXMLStreamWriter(OutputStream out, String encoding)
Deprecated.
-
createXMLStreamWriter
public static XMLStreamWriter createXMLStreamWriter(OutputStream out, String encoding, boolean declare)
Deprecated.Usecreate(OutputStream, String)
. The boolean flag was unused anyway.
-
-