com.ebmwebsourcing.easycommons.xml
Class XMLInputFactories

java.lang.Object
  extended by com.ebmwebsourcing.easycommons.xml.XMLInputFactories

public final class XMLInputFactories
extends java.lang.Object

A static pool of XMLInputFactory to improve XMLInputFactory creation efficiency. A XMLInputFactory is initialized the first time this class is used. An infinite number (integer maximum value) of XMLInputFactory may be created. They are never evicted.

Author:
Christophe DENEUX - EBM WebSourcing

Constructor Summary
XMLInputFactories()
           
 
Method Summary
static javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream InputStream)
          Create a XMLStreamReader from a specified InputStream by using the pool of XMLInputFactory
static void releaseXMLInputFactory(javax.xml.stream.XMLInputFactory xmlInputFactory)
          Release a XMLInputFactory to the pool
static javax.xml.stream.XMLInputFactory takeXMLInputFactory()
          Take a XMLInputFactory from the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLInputFactories

public XMLInputFactories()
Method Detail

takeXMLInputFactory

public static final javax.xml.stream.XMLInputFactory takeXMLInputFactory()
                                                                  throws PoolException
Take a XMLInputFactory from the pool

Returns:
one XMLInputFactory
Throws:
PoolException - if the current thread waits for a XMLInputFactory of the pool and is interrupted

releaseXMLInputFactory

public static final void releaseXMLInputFactory(javax.xml.stream.XMLInputFactory xmlInputFactory)
Release a XMLInputFactory to the pool

Parameters:
xmlInputFactory - a XMLInputFactory to release

createXMLStreamReader

public static final javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream InputStream)
                                                                    throws javax.xml.stream.XMLStreamException
Create a XMLStreamReader from a specified InputStream by using the pool of XMLInputFactory

Parameters:
InputStream - an InputStream
Returns:
the XMLStreamReader
Throws:
javax.xml.stream.XMLStreamException - if an unexpected processing errors occurs


Copyright © 2012 Petals Link. All Rights Reserved.