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
XMLOutputFactoryand allows us to reuseXMLStreamWriterinstances when appropriate.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMLStreamWriterFactory.DefaultDefaultXMLStreamWriterFactoryimplementation that can work with anyXMLOutputFactory.static classXMLStreamWriterFactory.HasEncodingWriterstatic classXMLStreamWriterFactory.NoLockForXMLOutputFactoryis thread safe.static interfaceXMLStreamWriterFactory.RecycleAwareInterface that can be implemented byXMLStreamWriterto be notified when it's recycled.static classXMLStreamWriterFactory.ZephyrXMLStreamWriterFactoryimplementation 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
XMLStreamReaderinstance. 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- TheXMLStreamReaderinstance that the caller finished using. This could be anyXMLStreamReaderimplementation, 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 singletonXMLStreamWriterFactoryinstance 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.
-
-