public abstract class XMLEventUtilBase extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
logger |
static String |
NAMESPACE_AWARE_PROP
XMLInputFactory key for configuring namespace awareness
|
static String |
REPAIR_NAMESPACE_PROP
XMLOutputFactory key for configuring namespace repairing
|
| Modifier | Constructor and Description |
|---|---|
protected |
XMLEventUtilBase(XMLEventReader reader,
XMLEventWriter writer,
XMLInputFactory inFactory,
XMLOutputFactory outFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addObjectEvent(XMLEvent objEvent)
Called to add the given event to the given writer for the current object.
|
void |
close() |
protected abstract void |
closeImpl()
Does the actual close work for this instance, will only be called once.
|
static void |
closeQuietly(XMLEventReader reader)
Closes an XMLEventReader, swallowing any exceptions that are thrown.
|
protected void |
closeReader() |
protected void |
closeWriter() |
protected XMLEventFactory |
createEventFactory()
Constructs a new XMLEventFactory, called by
getEventFactory the first time an XMLEventFactory is
needed. |
static XMLInputFactory |
createInputFactory()
Creates an XMLInputFactory which is namespace aware.
|
static XMLInputFactory |
createInputFactory(boolean namespaceAware)
Creates an XMLInputFactory which is optionally namespace aware.
|
static XMLOutputFactory |
createOutputFactory()
Creates an XMLOutputFactory which will repair namespaces.
|
static XMLOutputFactory |
createOutputFactory(boolean repairNamespaces)
Creates an XMLOutputFactory which will optionally repair namespaces.
|
static StartElement |
findNextElementStart(XMLEventReader reader)
Returns the next XMLEvent which is a start element, or
null if none found. |
protected void |
finishObject()
Called when an current object is finished.
|
protected XMLEventFactory |
getEventFactory()
Returns a valid XMLEventFactory.
|
protected XMLInputFactory |
getInputFactory() |
protected XMLOutputFactory |
getOutputFactory() |
protected XMLEventReader |
getReader() |
protected XMLEventWriter |
getWriter() |
protected XMLEventReader |
openReader(InputStream in) |
protected XMLEventWriter |
openWriter(OutputStream in) |
protected void |
setReader(XMLEventReader reader) |
protected void |
setWriter(XMLEventWriter writer) |
protected void |
startObject(XMLEvent objStartEvent)
Called when a new object is about to be processed.
|
protected static final Logger logger
public static final String NAMESPACE_AWARE_PROP
public static final String REPAIR_NAMESPACE_PROP
protected XMLEventUtilBase(XMLEventReader reader, XMLEventWriter writer, XMLInputFactory inFactory, XMLOutputFactory outFactory)
protected XMLEventReader getReader()
protected XMLEventWriter getWriter()
protected void setReader(XMLEventReader reader)
protected void setWriter(XMLEventWriter writer)
protected XMLInputFactory getInputFactory()
protected XMLOutputFactory getOutputFactory()
protected XMLEventReader openReader(InputStream in) throws XMLStreamException
XMLStreamExceptionprotected void closeReader()
protected XMLEventWriter openWriter(OutputStream in) throws XMLStreamException
XMLStreamExceptionprotected void closeWriter()
throws XMLStreamException
XMLStreamExceptionprotected XMLEventFactory getEventFactory()
createEventFactory() on first invocation to actully create the
XMLEventFactory, which is then cached for subsequent reuse.protected XMLEventFactory createEventFactory()
getEventFactory the first time an XMLEventFactory is
needed.protected void startObject(XMLEvent objStartEvent) throws XMLStreamException
Base class does nothing.
objStartEvent - the first event for this object, should not be written to the writer at this point,
merely provided for context (will be written by first call to addObjectEvent(javax.xml.stream.events.XMLEvent))XMLStreamExceptionprotected void addObjectEvent(XMLEvent objEvent) throws XMLStreamException
Base class calls XMLEventWriter.add(javax.xml.stream.events.XMLEvent) with the given event.
objEvent - the next input event to be processedXMLStreamExceptionprotected void finishObject()
throws XMLStreamException
Base class does nothing.
XMLStreamExceptionpublic final void close()
close in interface Closeableclose in interface AutoCloseableprotected abstract void closeImpl()
public static void closeQuietly(XMLEventReader reader)
reader - XMLEventReader to close, may be nullpublic static StartElement findNextElementStart(XMLEventReader reader) throws XMLStreamException
null if none found.XMLStreamExceptionpublic static XMLInputFactory createInputFactory()
public static XMLInputFactory createInputFactory(boolean namespaceAware)
namespaceAware - whether or not the factory is namespace awarepublic static XMLOutputFactory createOutputFactory()
public static XMLOutputFactory createOutputFactory(boolean repairNamespaces)
repairNamespaces - whether or not the factory will repair namespaces