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
public abstract class XMLStreamReaderFactory extends Object
Factory forXMLStreamReader
.This wraps
XMLInputFactory
and allows us to reuseXMLStreamReader
instances when appropriate.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XMLStreamReaderFactory.Default
DefaultXMLStreamReaderFactory
implementation that can work with anyXMLInputFactory
.static class
XMLStreamReaderFactory.NoLock
Similar toXMLStreamReaderFactory.Default
but doesn't do any synchronization.static interface
XMLStreamReaderFactory.RecycleAware
Interface that can be implemented byXMLStreamReader
to be notified when it's recycled.static class
XMLStreamReaderFactory.Woodstox
Handles Woodstox's XIF, but sets properties to do the string interning, sets various limits, ...
-
Constructor Summary
Constructors Constructor Description XMLStreamReaderFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static XMLStreamReader
create(String systemId, InputStream in, boolean rejectDTDs)
static XMLStreamReader
create(String systemId, InputStream in, String encoding, boolean rejectDTDs)
static XMLStreamReader
create(String systemId, Reader reader, boolean rejectDTDs)
static XMLStreamReader
create(InputSource source, boolean rejectDTDs)
abstract XMLStreamReader
doCreate(String systemId, InputStream in, boolean rejectDTDs)
abstract XMLStreamReader
doCreate(String systemId, Reader reader, boolean rejectDTDs)
abstract void
doRecycle(XMLStreamReader r)
static XMLStreamReaderFactory
get()
static void
recycle(XMLStreamReader r)
Should be invoked when the code finished using anXMLStreamReader
.static void
set(XMLStreamReaderFactory f)
Overrides the singletonXMLStreamReaderFactory
instance that the JAX-WS RI uses.
-
-
-
Method Detail
-
set
public static void set(XMLStreamReaderFactory f)
Overrides the singletonXMLStreamReaderFactory
instance that the JAX-WS RI uses.
-
get
public static XMLStreamReaderFactory get()
-
create
public static XMLStreamReader create(InputSource source, boolean rejectDTDs)
-
create
public static XMLStreamReader create(@Nullable String systemId, InputStream in, boolean rejectDTDs)
-
create
public static XMLStreamReader create(@Nullable String systemId, InputStream in, @Nullable String encoding, boolean rejectDTDs)
-
create
public static XMLStreamReader create(@Nullable String systemId, Reader reader, boolean rejectDTDs)
-
recycle
public static void recycle(XMLStreamReader r)
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
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 invoked 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.
-
doCreate
public abstract XMLStreamReader doCreate(String systemId, InputStream in, boolean rejectDTDs)
-
doCreate
public abstract XMLStreamReader doCreate(String systemId, Reader reader, boolean rejectDTDs)
-
doRecycle
public abstract void doRecycle(XMLStreamReader r)
-
-