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

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

public abstract class XMLStreamReaderFactory
extends Object

Factory for XMLStreamReader.

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

Author:
Kohsuke Kawaguchi

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 sets properties to do the string interning, sets various limits, ...
 
Constructor Summary
XMLStreamReaderFactory()
           
 
Method Summary
static XMLStreamReader create(InputSource source, boolean rejectDTDs)
           
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)
           
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 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 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 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 invoked 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 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)


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.