Package com.sun.xml.ws.api.streaming
Class XMLStreamReaderFactory
java.lang.Object
com.sun.xml.ws.api.streaming.XMLStreamReaderFactory
- Direct Known Subclasses:
FastInfosetStreamReaderFactory,XMLStreamReaderFactory.Default,XMLStreamReaderFactory.NoLock
Factory for
XMLStreamReader.
This wraps XMLInputFactory and allows us to reuse XMLStreamReader instances
when appropriate.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDefaultXMLStreamReaderFactoryimplementation that can work with anyXMLInputFactory.static classSimilar toXMLStreamReaderFactory.Defaultbut doesn't do any synchronization.static interfaceInterface that can be implemented byXMLStreamReaderto be notified when it's recycled.static final classHandles Woodstox's XIF, but sets properties to do the string interning, sets various limits, ... -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XMLStreamReadercreate(String systemId, InputStream in, boolean rejectDTDs) static XMLStreamReadercreate(String systemId, InputStream in, String encoding, boolean rejectDTDs) static XMLStreamReaderstatic XMLStreamReadercreate(InputSource source, boolean rejectDTDs) abstract XMLStreamReaderdoCreate(String systemId, InputStream in, boolean rejectDTDs) abstract XMLStreamReaderabstract voidstatic XMLStreamReaderFactoryget()static voidShould be invoked when the code finished using anXMLStreamReader.static voidOverrides the singletonXMLStreamReaderFactoryinstance that the JAX-WS RI uses.
-
Constructor Details
-
XMLStreamReaderFactory
protected XMLStreamReaderFactory()Default constructor.
-
-
Method Details
-
set
Overrides the singletonXMLStreamReaderFactoryinstance that the JAX-WS RI uses. -
get
-
create
-
create
-
create
public static XMLStreamReader create(@Nullable String systemId, InputStream in, @Nullable String encoding, boolean rejectDTDs) -
create
-
recycle
Should be invoked when the code finished using anXMLStreamReader.If the recycled instance implements
XMLStreamReaderFactory.RecycleAware,XMLStreamReaderFactory.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 invoked 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.
-
doCreate
-
doCreate
-
doRecycle
-