Package com.fasterxml.aalto.evt
Class EventAllocatorImpl
- java.lang.Object
-
- org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl
-
- com.fasterxml.aalto.evt.EventAllocatorImpl
-
- All Implemented Interfaces:
javax.xml.stream.util.XMLEventAllocator
,javax.xml.stream.XMLStreamConstants
public final class EventAllocatorImpl extends org.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl
Specialized event allocator implementation. Beyond additions needed to support DTD entities, implements non-location-preserving optimization.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_cfgPreserveLocation
protected javax.xml.stream.Location
_lastLocation
Last used location info; only relevant to non-accurate-location allocators.(package private) static EventAllocatorImpl
sStdInstance
-
Constructor Summary
Constructors Modifier Constructor Description protected
EventAllocatorImpl(boolean preserveLocation)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.stream.events.XMLEvent
allocate(javax.xml.stream.XMLStreamReader r)
static EventAllocatorImpl
getDefaultInstance()
static EventAllocatorImpl
getFastInstance()
protected javax.xml.stream.Location
getLocation(javax.xml.stream.XMLStreamReader r)
Method used to get theLocation
object to use for an event to create.javax.xml.stream.util.XMLEventAllocator
newInstance()
Default implementation assumes that the caller knows how to share instances, and so need not create new copies.
-
-
-
Field Detail
-
sStdInstance
static final EventAllocatorImpl sStdInstance
-
_cfgPreserveLocation
protected final boolean _cfgPreserveLocation
-
_lastLocation
protected javax.xml.stream.Location _lastLocation
Last used location info; only relevant to non-accurate-location allocators.
-
-
Constructor Detail
-
EventAllocatorImpl
protected EventAllocatorImpl(boolean preserveLocation)
- Parameters:
preserveLocation
- 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
-
getDefaultInstance
public static EventAllocatorImpl getDefaultInstance()
-
getFastInstance
public static EventAllocatorImpl getFastInstance()
-
newInstance
public 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.
- Specified by:
newInstance
in interfacejavax.xml.stream.util.XMLEventAllocator
- Overrides:
newInstance
in classorg.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl
-
allocate
public javax.xml.stream.events.XMLEvent allocate(javax.xml.stream.XMLStreamReader r) throws javax.xml.stream.XMLStreamException
- Specified by:
allocate
in interfacejavax.xml.stream.util.XMLEventAllocator
- Overrides:
allocate
in classorg.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl
- Throws:
javax.xml.stream.XMLStreamException
-
getLocation
protected javax.xml.stream.Location getLocation(javax.xml.stream.XMLStreamReader r)
Method used to get theLocation
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).- Overrides:
getLocation
in classorg.codehaus.stax2.ri.evt.Stax2EventAllocatorImpl
-
-