This base class uses EventFactory to create events as recommended in the JavaDoc of XMLEventAllocator. However, creating new object per each event reduces performance. The implementation of EventReader therefore will set the Allocator to StAXEventAllocator which implements the Allocate methods without creating new objects.
The spec for the first Allocate method states that it must NOT modify the state of the Reader while the second MAY. For consistency, both Allocate methods in this implementation will NOT modify the state.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv XMLEventFactory |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | |
| protected void | |
| public XMLEvent | Returns: the event corresponding to the current reader stateThe XMLStreamReader to allocate from streamReader)Implements javax. This method allocates an event given the current state of the XMLStreamReader. |
| public void | allocate(XMLStreamReader
The XMLStreamReader to allocate from streamReader, 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. |
| pack-priv XMLEvent | |
| public XMLEventAllocator | newInstance()
Implements javax. This method creates an instance of the XMLEventAllocator. |
| factory | back to summary |
|---|---|
| pack-priv XMLEventFactory factory | |
| StAXEventAllocatorBase | back to summary |
|---|---|
| public StAXEventAllocatorBase() Creates a new instance of XMLEventAllocator | |
| addAttributes | back to summary |
|---|---|
| protected void addAttributes(StartElementEvent event, XMLStreamReader streamReader) | |
| addNamespaces | back to summary |
|---|---|
| protected void addNamespaces(StartElementEvent event, XMLStreamReader streamReader) | |
| addNamespaces | back to summary |
|---|---|
| protected void addNamespaces(EndElementEvent event, XMLStreamReader streamReader) | |
| allocate | back to summary |
|---|---|
| public XMLEvent allocate(XMLStreamReader streamReader) throws XMLStreamException Implements 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 state and events this method will return null.
| |
| allocate | back to summary |
|---|---|
| public void allocate(XMLStreamReader streamReader, XMLEventConsumer consumer) throws XMLStreamException 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.
| |
| getXMLEvent | back to summary |
|---|---|
| pack-priv XMLEvent getXMLEvent(XMLStreamReader reader) | |
| newInstance | back to summary |
|---|---|
| public XMLEventAllocator newInstance() Implements javax. This method creates an instance of the XMLEventAllocator. This allows the XMLInputFactory to allocate a new instance per reader.
| |