com.sun.xml.ws.api.streaming
Class XMLStreamReaderFactory

java.lang.Object
  extended by com.sun.xml.ws.api.streaming.XMLStreamReaderFactory
Direct Known Subclasses:
XMLStreamReaderFactory.NoLock, XMLStreamReaderFactory.Zephyr

public abstract class XMLStreamReaderFactory
extends Object

Factory for XMLStreamReader.

This wraps XMLInputFactory and allows us to reuse XMLStreamReader instances when appropriate.


Nested Class Summary
static class XMLStreamReaderFactory.Default
          Default XMLStreamReaderFactory implementation that can work with any XMLInputFactory.
static class XMLStreamReaderFactory.NoLock
          Similar to XMLStreamReaderFactory.Default but doesn't do any synchronization.
static interface XMLStreamReaderFactory.RecycleAware
          Interface that can be implemented by XMLStreamReader to be notified when it's recycled.
static class XMLStreamReaderFactory.Woodstox
          Handles Woodstox's XIF but set properties to do the string interning.
static class XMLStreamReaderFactory.Zephyr
          XMLStreamReaderFactory implementation for SJSXP/JAXP RI.
 
Constructor Summary
XMLStreamReaderFactory()
           
 
Method Summary
static javax.xml.stream.XMLStreamReader create(InputSource source, boolean rejectDTDs)
           
static javax.xml.stream.XMLStreamReader create(String systemId, InputStream in, boolean rejectDTDs)
           
static javax.xml.stream.XMLStreamReader create(String systemId, InputStream in, String encoding, boolean rejectDTDs)
           
static javax.xml.stream.XMLStreamReader create(String systemId, Reader reader, boolean rejectDTDs)
           
abstract  javax.xml.stream.XMLStreamReader doCreate(String systemId, InputStream in, boolean rejectDTDs)
           
abstract  javax.xml.stream.XMLStreamReader doCreate(String systemId, Reader reader, boolean rejectDTDs)
           
abstract  void doRecycle(javax.xml.stream.XMLStreamReader r)
           
static XMLStreamReaderFactory get()
           
static void recycle(javax.xml.stream.XMLStreamReader r)
          Should be invoked when the code finished using an XMLStreamReader.
static void set(XMLStreamReaderFactory f)
          Overrides the singleton XMLStreamReaderFactory instance that the JAX-WS RI uses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLStreamReaderFactory

public XMLStreamReaderFactory()
Method Detail

set

public static void set(XMLStreamReaderFactory f)
Overrides the singleton XMLStreamReaderFactory instance that the JAX-WS RI uses.


get

public static XMLStreamReaderFactory get()

create

public static javax.xml.stream.XMLStreamReader create(InputSource source,
                                                      boolean rejectDTDs)

create

public static javax.xml.stream.XMLStreamReader create(@Nullable
                                                      String systemId,
                                                      InputStream in,
                                                      boolean rejectDTDs)

create

public static javax.xml.stream.XMLStreamReader create(@Nullable
                                                      String systemId,
                                                      InputStream in,
                                                      @Nullable
                                                      String encoding,
                                                      boolean rejectDTDs)

create

public static javax.xml.stream.XMLStreamReader create(@Nullable
                                                      String systemId,
                                                      Reader reader,
                                                      boolean rejectDTDs)

recycle

public static void recycle(javax.xml.stream.XMLStreamReader r)
Should be invoked when the code finished using an XMLStreamReader.

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 invked by multiple threads concurrently.

Parameters:
r - The XMLStreamReader instance that the caller finished using. This could be any XMLStreamReader 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 javax.xml.stream.XMLStreamReader doCreate(String systemId,
                                                          InputStream in,
                                                          boolean rejectDTDs)

doCreate

public abstract javax.xml.stream.XMLStreamReader doCreate(String systemId,
                                                          Reader reader,
                                                          boolean rejectDTDs)

doRecycle

public abstract void doRecycle(javax.xml.stream.XMLStreamReader r)