com.ebmwebsourcing.easycommons.xml
Class XMLOutputFactories

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

public final class XMLOutputFactories
extends java.lang.Object

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

Author:
Nicolas Oddoux - EBM WebSourcing

Constructor Summary
XMLOutputFactories()
           
 
Method Summary
static javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.OutputStream outputStream)
          Create a XMLStreamWriter from a specified OutputStream by using the pool of XMLOutputFactory
static void releaseXMLOutputFactory(javax.xml.stream.XMLOutputFactory xmlOutputFactory)
          Release a XMLOutputFactory to the pool
static javax.xml.stream.XMLOutputFactory takeXMLOutputFactory()
          Take a XMLOutputFactory from the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLOutputFactories

public XMLOutputFactories()
Method Detail

takeXMLOutputFactory

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

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

releaseXMLOutputFactory

public static final void releaseXMLOutputFactory(javax.xml.stream.XMLOutputFactory xmlOutputFactory)
Release a XMLOutputFactory to the pool

Parameters:
xmlOutputFactory - a XMLOutputFactory to release

createXMLStreamWriter

public static final javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.OutputStream outputStream)
                                                                    throws javax.xml.stream.XMLStreamException
Create a XMLStreamWriter from a specified OutputStream by using the pool of XMLOutputFactory

Parameters:
outputStream - an OutputStream
Returns:
the XMLStreamWriter
Throws:
javax.xml.stream.XMLStreamException - if an unexpected processing errors occurs


Copyright © 2012 Petals Link. All Rights Reserved.