Class SavotPullEngine

  • All Implemented Interfaces:
    Markups

    public final class SavotPullEngine
    extends java.lang.Object
    implements Markups

    It has been tested with kXML Pull parser implementation

    but it is possible to use other pull parsers

    Designed to use with Pull parsers complient with Standard Pull Implementation v1

    LBO: Note: equalsIgnoreCase() vs() equals as XML is case sensitive and VOTable specification says that clearly
    Author:
    Andre Schaaff
    • Field Detail

      • FULL

        public static final int FULL
        FULL parsing mode: deprecated and replaced by FULLREAD
        See Also:
        Constant Field Values
      • FULLREAD

        public static final int FULLREAD
        FULLREAD parsing mode all in memory
        See Also:
        Constant Field Values
      • SEQUENTIAL

        public static final int SEQUENTIAL
        SEQUENTIAL parsing mode: deprecated and replaced by RESOURCEREAD
        See Also:
        Constant Field Values
      • RESOURCEREAD

        public static final int RESOURCEREAD
        RESOURCEREAD parsing mode: row per row reading
        See Also:
        Constant Field Values
      • ROWREAD

        public static final int ROWREAD
        ROWREAD parsing mode: row per row reading
        See Also:
        Constant Field Values
      • DEFAULT_STACK_CAPACITY

        public static final int DEFAULT_STACK_CAPACITY
        default stack capacity = 4 slots
        See Also:
        Constant Field Values
    • Constructor Detail

      • SavotPullEngine

        public SavotPullEngine​(org.xmlpull.v1.XmlPullParser parser,
                               java.lang.String file,
                               int mode,
                               boolean debug,
                               SavotStatistics stats)
        Constructor
        Parameters:
        parser -
        file - a file to parse
        mode - FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)
        debug -
        stats -
      • SavotPullEngine

        public SavotPullEngine​(org.xmlpull.v1.XmlPullParser parser,
                               java.net.URL url,
                               int mode,
                               java.lang.String enc,
                               boolean debug,
                               SavotStatistics stats)
        Constructor
        Parameters:
        parser -
        url - url to parse
        mode - FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)
        enc - encoding (example : UTF-8)
        debug -
        stats -
      • SavotPullEngine

        public SavotPullEngine​(org.xmlpull.v1.XmlPullParser parser,
                               java.io.InputStream instream,
                               int mode,
                               java.lang.String enc,
                               boolean debug,
                               SavotStatistics stats)
        Constructor
        Parameters:
        parser -
        instream - stream to parse
        mode - FULL (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per TR for small memory size applications)
        enc - encoding (example : UTF-8)
        debug -
        stats -
      • SavotPullEngine

        public SavotPullEngine​(org.xmlpull.v1.XmlPullParser parser,
                               java.io.Reader reader,
                               int mode,
                               boolean debug,
                               SavotStatistics stats)
        Constructor
        Parameters:
        parser -
        reader - reader to parse
        mode - FULL (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per TR for small memory size applications)
        debug -
        stats -
    • Method Detail

      • close

        public void close()
        Close the input stream if still opened and free the internal parser
      • reset

        public void reset()
        Reset of the engine before another parsing LBO: useless methods ?
      • parse

        public void parse​(int parsingType)
                   throws java.io.IOException,
                          java.lang.Exception
        Parsing engine
        Parameters:
        parsingType - FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)
        Throws:
        java.io.IOException
        java.lang.Exception
      • getNextResource

        public SavotResource getNextResource()
        Get the next Resource (warning : RESOURCEREAD mode only)
        Returns:
        a SavotResource (always NULL if other mode)
      • getNextTR

        public SavotTR getNextTR()
        Get the next TR (warning : ROWREAD mode only)
        Returns:
        a SavotTR (always NULL if other mode)
      • getVOTable

        public SavotVOTable getVOTable()
        Get a reference to V0TABLE object
        Returns:
        SavotVOTable
      • getResourceCount

        public int getResourceCount()
        Get the number of RESOURCE elements in the document (for statistics)
        Returns:
        a long value
      • getTableCount

        public int getTableCount()
        Get the number of TABLE elements in the document (for statistics)
        Returns:
        a long value
      • getTRCount

        public int getTRCount()
        Get the number of TR elements in the document (for statistics)
        Returns:
        a long value
      • getDataCount

        public int getDataCount()
        Get the number of DATA elements in the document (for statistics)
        Returns:
        a long value
      • getIdRefLinks

        public java.util.Map<java.lang.String,​java.lang.Object> getIdRefLinks()
        Get a reference on the Hashtable containing the link between ID and ref
        Returns:
        a refernce to the Hashtable
      • getResourceFromRef

        public SavotResource getResourceFromRef​(java.lang.String ref)
        Search a RESOURCE corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        a reference to a SavotResource object
      • getFieldFromRef

        public SavotField getFieldFromRef​(java.lang.String ref)
        Search a FIELD corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotField
      • getFieldRefFromRef

        public SavotFieldRef getFieldRefFromRef​(java.lang.String ref)
        Search a FIELDref corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotFieldRef
      • getParamFromRef

        public SavotParam getParamFromRef​(java.lang.String ref)
        Search a PARAM corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotParam
      • getParamRefFromRef

        public SavotParamRef getParamRefFromRef​(java.lang.String ref)
        Search a PARAMref corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotParamRef
      • getTableFromRef

        public SavotTable getTableFromRef​(java.lang.String ref)
        Search a TABLE corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotTable
      • getGroupFromRef

        public SavotGroup getGroupFromRef​(java.lang.String ref)
        Search a GROUP corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotGROUP
      • getInfoFromRef

        public SavotInfo getInfoFromRef​(java.lang.String ref)
        Search a RESOURCE corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotInfo
      • getValuesFromRef

        public SavotValues getValuesFromRef​(java.lang.String ref)
        Search a VALUES corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotValues
      • getLinkFromRef

        public SavotLink getLinkFromRef​(java.lang.String ref)
        Search a LINK corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotLink
      • getCoosysFromRef

        public SavotCoosys getCoosysFromRef​(java.lang.String ref)
        Search a COOSYS corresponding to an ID ref
        Parameters:
        ref -
        Returns:
        SavotCoosys
      • getAllResources

        public SavotVOTable getAllResources()
        Get current VOTable (all resources)
        Returns:
        SavotVOTable
      • enableDebug

        public void enableDebug​(boolean debug)
        Enable debug mode
        Parameters:
        debug - boolean