Class MXParserCachingStrings

  • All Implemented Interfaces:
    Cloneable, XmlPullParser
    Direct Known Subclasses:
    MXParserNonValidating

    public class MXParserCachingStrings
    extends MXParser
    implements Cloneable
    Extend MXP parser to use string cache of char[] to interned String

    NOTE: it is not non-validaint parser as there is no supporting internal DTD parsing no full XML 1.0 (or 1.1) character classes are supported.

    Author:
    Aleksander Slominski
    • Field Detail

      • cacheStatCalls

        protected int cacheStatCalls
      • cacheStatWalks

        protected int cacheStatWalks
      • cacheStatResets

        protected int cacheStatResets
      • cacheStatRehash

        protected int cacheStatRehash
      • CACHE_LOAD

        protected static final int CACHE_LOAD
        NOTE: implemented as integers and not flot to allow to work on J2ME.
        See Also:
        Constant Field Values
      • cacheEntriesCount

        protected int cacheEntriesCount
      • cacheEntriesThreshold

        protected int cacheEntriesThreshold
      • keys

        protected char[][] keys
      • values

        protected String[] values
    • Constructor Detail

      • MXParserCachingStrings

        public MXParserCachingStrings()
    • Method Detail

      • getFeature

        public boolean getFeature​(String name)
        Description copied from class: MXParser
        Unknown properties are always returned as false
        Specified by:
        getFeature in interface XmlPullParser
        Overrides:
        getFeature in class MXParser
        Parameters:
        name - The name of feature to be retrieved.
        Returns:
        The value of the feature.
      • finalize

        public void finalize()
        Hook to GC finalization to print statistics about pool cache impl. perf.
        Overrides:
        finalize in class Object
      • newString

        protected String newString​(char[] cbuf,
                                   int off,
                                   int len)
        If feature name interning is enabled then this funtion MUST return interned string.
        Overrides:
        newString in class MXParser
      • newStringIntern

        protected String newStringIntern​(char[] cbuf,
                                         int off,
                                         int len)
        This is efficient implementation of pool that returns interned String based on char[] input.
        Overrides:
        newStringIntern in class MXParser
      • initStringCache

        protected void initStringCache()