Package org.biojava.utils.stax
Class IntElementHandlerBase
- java.lang.Object
-
- org.biojava.utils.stax.StAXContentHandlerBase
-
- org.biojava.utils.stax.IntElementHandlerBase
-
- All Implemented Interfaces:
StAXContentHandler
public abstract class IntElementHandlerBase extends StAXContentHandlerBase
StAX handler for any element which just contains a string representation of an integer.This class collects the string data, and when it is complete, passes it to the (abstract) setIntValue method. Typical use of this class is as a base for a small (often anonymous) class which takes the int value and stores it in some variable.
- Since:
- 1.2
- Author:
- Matthew Pocock, Greg Cox
-
-
Constructor Summary
Constructors Constructor Description IntElementHandlerBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int end)
Signal a span of character data in the XML input.void
endElement(String nsURI, String localName, String qName, StAXContentHandler handler)
protected abstract void
setIntValue(int val)
Override this method to do something useful with the int we collect.void
startElement(String nsURI, String localName, String qName, Attributes attrs, DelegationManager dm)
-
Methods inherited from class org.biojava.utils.stax.StAXContentHandlerBase
endPrefixMapping, endTree, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, startTree
-
-
-
-
Constructor Detail
-
IntElementHandlerBase
public IntElementHandlerBase()
-
-
Method Detail
-
startElement
public void startElement(String nsURI, String localName, String qName, Attributes attrs, DelegationManager dm) throws SAXException
- Specified by:
startElement
in interfaceStAXContentHandler
- Overrides:
startElement
in classStAXContentHandlerBase
- Throws:
SAXException
-
endElement
public void endElement(String nsURI, String localName, String qName, StAXContentHandler handler) throws SAXException
- Specified by:
endElement
in interfaceStAXContentHandler
- Overrides:
endElement
in classStAXContentHandlerBase
- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int end) throws SAXException
Description copied from class:StAXContentHandlerBase
Signal a span of character data in the XML input.- Specified by:
characters
in interfaceStAXContentHandler
- Overrides:
characters
in classStAXContentHandlerBase
- Parameters:
ch
- an array of charactersstart
- index of the first significant character for this event.end
- number of characters significant to this event.- Throws:
SAXException
-
setIntValue
protected abstract void setIntValue(int val) throws SAXException
Override this method to do something useful with the int we collect.This method will be invoked by endElement with the fully parsed int.
- Parameters:
val
- the fully parsed int- Throws:
SAXException
- if for any reason the int is not palatable
-
-