Top Description Fields Constructors Methods
com.fasterxml.aalto.evt

public final Class EventAllocatorImpl

extends Stax2EventAllocatorImpl
Class Inheritance
Imports
javax.xml.stream.*, javax.xml.stream.events.XMLEvent, javax.xml.stream.util.XMLEventAllocator, org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl, com.fasterxml.aalto.AsyncXMLStreamReader

Specialized event allocator implementation. Beyond additions needed to support DTD entities, implements non-location-preserving optimization.
Author
Tatu Saloranta

Field Summary

Modifier and TypeField and Description
protected final boolean
protected Location
_lastLocation

Last used location info; only relevant to non-accurate-location allocators.

pack-priv static final EventAllocatorImpl

Constructor Summary

AccessConstructor and Description
protected
EventAllocatorImpl(boolean
If true, allocator will construct instances that have accurate location information; if false, instances will only have some generic shared Location info. Latter option will reduce memory usage/thrashing a bit, and may improve speed.
preserveLocation
)

Method Summary

Modifier and TypeMethod and Description
public XMLEvent
allocate(XMLStreamReader
The XMLStreamReader to allocate from
r
)

Overrides org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl.allocate.

Implements javax.xml.stream.util.XMLEventAllocator.allocate.

This method allocates an event given the current state of the XMLStreamReader.
public static EventAllocatorImpl
public static EventAllocatorImpl
protected Location
getLocation(XMLStreamReader r)

Overrides org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl.getLocation.

Method used to get the Location object to use for an event to create.
public XMLEventAllocator
newInstance()

Overrides org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl.newInstance.

Implements javax.xml.stream.util.XMLEventAllocator.newInstance.

Default implementation assumes that the caller knows how to share instances, and so need not create new copies.
Inherited from org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl:
allocatecreateDTDcreateEntityReferencecreateStartElement

Field Detail

_cfgPreserveLocationback to summary
protected final boolean _cfgPreserveLocation
_lastLocationback to summary
protected Location _lastLocation

Last used location info; only relevant to non-accurate-location allocators.

sStdInstanceback to summary
pack-priv static final EventAllocatorImpl sStdInstance

Constructor Detail

EventAllocatorImplback to summary
protected EventAllocatorImpl(boolean preserveLocation)
Parameters
preserveLocation:boolean

If true, allocator will construct instances that have accurate location information; if false, instances will only have some generic shared Location info. Latter option will reduce memory usage/thrashing a bit, and may improve speed.

Method Detail

allocateback to summary
public XMLEvent allocate(XMLStreamReader r) throws XMLStreamException

Overrides org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl.allocate.

Implements javax.xml.stream.util.XMLEventAllocator.allocate.

Doc from javax.xml.stream.util.XMLEventAllocator.allocate.

This method allocates an event given the current state of the XMLStreamReader. If this XMLEventAllocator does not have a one-to-one mapping between reader states and events this method will return null. This method must not modify the state of the XMLStreamReader.

Parameters
r:XMLStreamReader

The XMLStreamReader to allocate from

Returns:XMLEvent

the event corresponding to the current reader state

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
getDefaultInstanceback to summary
public static EventAllocatorImpl getDefaultInstance()
getFastInstanceback to summary
public static EventAllocatorImpl getFastInstance()
getLocationback to summary
protected Location getLocation(XMLStreamReader r)

Overrides org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl.getLocation.

Method used to get the Location object to use for an event to create. Base implementation just calls stream reader's accessors, but sub-classes may choose to use other methods (esp. when not in "preserve location" mode).

Annotations
@Override
newInstanceback to summary
public XMLEventAllocator newInstance()

Overrides org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl.newInstance.

Implements javax.xml.stream.util.XMLEventAllocator.newInstance.

Default implementation assumes that the caller knows how to share instances, and so need not create new copies.

Note

if this class is sub-classes, this method should be redefined if assumptions about shareability do not hold.

Returns:XMLEventAllocator

Doc from javax.xml.stream.util.XMLEventAllocator.newInstance.

an instance of the XMLEventAllocator

Annotations
@Override