XMLEventAllocator, to be
used with Woodstox' event reader.
One of few complications here is the way start elements are constructed. The pattern used is double-indirection, needed to get a callback from the stream reader, with data we need for constructing even Object... but without stream reader having any understanding of event Objects per se.
03-Dec-2004, TSa: One additional twist is that it's now possible to create slightly faster event handling, by indicating that the fully accurate Location information is not necessary. If so, allocator will just use one shared Location object passed to all event objects constructed.
| Modifier and Type | Field and Description |
|---|---|
| protected final boolean | |
| protected Location | mLastLocation
Last used location info; only relevant to non-accurate-location allocators. |
| pack-priv static final DefaultEventAllocator |
| Access | Constructor and Description |
|---|---|
| protected | DefaultEventAllocator(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. accurateLocation)
|
| Modifier and Type | Method and Description |
|---|---|
| public XMLEvent | allocate(XMLStreamReader
The XMLStreamReader to allocate from r)Implements javax. This method allocates an event given the current state of the XMLStreamReader. |
| public void | allocate(XMLStreamReader
The XMLStreamReader to allocate from r, XMLEventConsumer The XMLEventConsumer to add to. consumer)Implements javax. This method allocates an event or set of events given the current state of the XMLStreamReader and adds the event or set of events to the consumer that was passed in. This method can be used to expand or contract reader states into event states. |
| public static DefaultEventAllocator | |
| public static DefaultEventAllocator | |
| public XMLEventAllocator | newInstance()
Implements javax. This method creates an instance of the XMLEventAllocator. |
| public Object | withStartElement(Location loc, QName name, BaseNsContext nsCtxt, ElemAttrs attrs, boolean wasEmpty)
Implements abstract com.
|
| mAccurateLocation | back to summary |
|---|---|
| protected final boolean mAccurateLocation | |
| mLastLocation | back to summary |
|---|---|
| protected Location mLastLocation Last used location info; only relevant to non-accurate-location allocators. | |
| sStdInstance | back to summary |
|---|---|
| pack-priv static final DefaultEventAllocator sStdInstance | |
| DefaultEventAllocator | back to summary |
|---|---|
protected DefaultEventAllocator(boolean accurateLocation)
| |
| allocate | back to summary |
|---|---|
| public XMLEvent allocate(XMLStreamReader r) throws XMLStreamException Implements javax. Doc from javax. 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.
| |
| allocate | back to summary |
|---|---|
| public void allocate(XMLStreamReader r, XMLEventConsumer consumer) throws XMLStreamException Implements javax. Doc from javax. This method allocates an event or set of events given the current state of the XMLStreamReader and adds the event or set of events to the consumer that was passed in. This method can be used to expand or contract reader states into event states. This method may modify the state of the XMLStreamReader.
| |
| getDefaultInstance | back to summary |
|---|---|
| public static DefaultEventAllocator getDefaultInstance() | |
| getFastInstance | back to summary |
|---|---|
| public static DefaultEventAllocator getFastInstance() | |
| newInstance | back to summary |
|---|---|
| public XMLEventAllocator newInstance() Implements javax. Doc from javax. This method creates an instance of the XMLEventAllocator. This allows the XMLInputFactory to allocate a new instance per reader.
| |
| withStartElement | back to summary |
|---|---|
| public Object withStartElement(Location loc, QName name, BaseNsContext nsCtxt, ElemAttrs attrs, boolean wasEmpty) Implements abstract com.
| |