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
Factory for
XMLStreamWriter.
This wraps XMLOutputFactory and allows us to reuse XMLStreamWriter instances
when appropriate.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDefaultXMLStreamWriterFactoryimplementation that can work with anyXMLOutputFactory.static classstatic final classForXMLOutputFactoryis thread safe.static interfaceInterface that can be implemented byXMLStreamWriterto be notified when it's recycled.static final classXMLStreamWriterFactoryimplementation for Sun's StaX implementation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XMLStreamWritercreate(OutputStream out) Short-cut forcreate(OutputStream, String)with UTF-8.static XMLStreamWritercreate(OutputStream out, String encoding) abstract XMLStreamWriterdoCreate(OutputStream out) Seecreate(OutputStream)for the contract.abstract XMLStreamWriterdoCreate(OutputStream out, String encoding) Seecreate(OutputStream,String)for the contract.abstract voidSeerecycle(XMLStreamWriter)for the contract.static XMLStreamWriterFactoryget()Gets the singleton instance.static voidShould be invoked when the code finished using anXMLStreamWriter.static voidOverrides the singletonXMLStreamWriterFactoryinstance that the JAX-WS RI uses.
-
Constructor Details
-
XMLStreamWriterFactory
protected XMLStreamWriterFactory()Default constructor.
-
-
Method Details
-
doCreate
Seecreate(OutputStream)for the contract. This method may be invoked concurrently. -
doCreate
Seecreate(OutputStream,String)for the contract. This method may be invoked concurrently. -
doRecycle
Seerecycle(XMLStreamWriter)for the contract. This method may be invoked concurrently. -
recycle
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
Gets the singleton instance. -
set
Overrides the singletonXMLStreamWriterFactoryinstance that the JAX-WS RI uses.- Parameters:
f- must not be null.
-
create
Short-cut forcreate(OutputStream, String)with UTF-8. -
create
-