Package org.xmlpull.mxp1
Class MXParserCachingStrings
- java.lang.Object
-
- org.xmlpull.mxp1.MXParser
-
- org.xmlpull.mxp1.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 StringNOTE: 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 Summary
Fields Modifier and Type Field Description protected static intCACHE_LOADNOTE: implemented as integers and not flot to allow to work on J2ME.protected static booleanCACHE_STATISTICSprotected intcacheEntriesCountprotected intcacheEntriesThresholdprotected intcacheStatCallsprotected intcacheStatRehashprotected intcacheStatResetsprotected intcacheStatWalksprotected static intINITIAL_CAPACITYprotected char[][]keysprotected static booleanTRACE_SIZINGprotected String[]values-
Fields inherited from class org.xmlpull.mxp1.MXParser
allStringsInterned, attributeCount, attributeName, attributeNameHash, attributePrefix, attributeUri, attributeValue, buf, bufAbsoluteStart, bufEnd, bufLoadFactor, bufSoftLimit, bufStart, charRefOneCharBuf, columnNumber, depth, elName, elNamespaceCount, elPrefix, elRawName, elRawNameEnd, elRawNameLine, elUri, emptyElementTag, entityEnd, entityName, entityNameBuf, entityNameHash, entityRefName, entityReplacement, entityReplacementBuf, eventType, FEATURE_NAMES_INTERNED, FEATURE_XML_ROUNDTRIP, inputEncoding, inputStream, lineNumber, location, LOOKUP_MAX, LOOKUP_MAX_CHAR, lookupNameChar, lookupNameStartChar, namespaceEnd, namespacePrefix, namespacePrefixHash, namespaceUri, NCODING, NO, pastEndTag, pc, pcEnd, pcStart, pos, posEnd, posStart, preventBufferCompaction, processNamespaces, PROPERTY_LOCATION, PROPERTY_XMLDECL_CONTENT, PROPERTY_XMLDECL_STANDALONE, PROPERTY_XMLDECL_VERSION, reachedEnd, READ_CHUNK_SIZE, reader, roundtripSupported, seenAmpersand, seenDocdecl, seenEndTag, seenMarkup, seenRoot, seenStartTag, TANDALONE, text, tokenize, usePC, VERSION, XML_URI, xmlDeclContent, xmlDeclStandalone, xmlDeclVersion, XMLNS_URI, YES
-
Fields inherited from interface org.xmlpull.v1.XmlPullParser
CDSECT, COMMENT, DOCDECL, END_DOCUMENT, END_TAG, ENTITY_REF, FEATURE_PROCESS_DOCDECL, FEATURE_PROCESS_NAMESPACES, FEATURE_REPORT_NAMESPACE_ATTRIBUTES, FEATURE_VALIDATION, IGNORABLE_WHITESPACE, NO_NAMESPACE, PROCESSING_INSTRUCTION, START_DOCUMENT, START_TAG, TEXT, TYPES
-
-
Constructor Summary
Constructors Constructor Description MXParserCachingStrings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()voidfinalize()Hook to GC finalization to print statistics about pool cache impl.booleangetFeature(String name)Unknown properties are always returned as falseprotected voidinitStringCache()protected StringnewString(char[] cbuf, int off, int len)If feature name interning is enabled then this funtion MUST return interned string.protected StringnewStringIntern(char[] cbuf, int off, int len)This is efficient implementation of pool that returns interned String based on char[] input.protected voidresetStringCache()voidsetFeature(String name, boolean state)This allows to change name iterning property in this enhanced impl.-
Methods inherited from class org.xmlpull.mxp1.MXParser
defineEntityReplacementText, ensureAttributesCapacity, ensureElementsCapacity, ensureEntityCapacity, ensureNamespacesCapacity, ensurePC, fastHash, fillBuf, getAttributeCount, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getColumnNumber, getDepth, getEventType, getInputEncoding, getLineNumber, getName, getNamespace, getNamespace, getNamespaceCount, getNamespacePrefix, getNamespaceUri, getPositionDescription, getPrefix, getProperty, getText, getTextCharacters, isAttributeDefault, isEmptyElementTag, isNameChar, isNameStartChar, isS, isWhitespace, joinPC, lookuEntityReplacement, more, next, nextImpl, nextTag, nextText, nextToken, parseAttribute, parseCDSect, parseComment, parseDocdecl, parseEndTag, parseEntityRef, parseEpilog, parsePI, parseProlog, parseStartTag, parseXmlDecl, parseXmlDeclWithVersion, printable, printable, require, requireInput, requireNextS, reset, setInput, setInput, setProperty, skipS, skipSubTree
-
-
-
-
Field Detail
-
CACHE_STATISTICS
protected static final boolean CACHE_STATISTICS
- See Also:
- Constant Field Values
-
TRACE_SIZING
protected static final boolean TRACE_SIZING
- See Also:
- Constant Field Values
-
INITIAL_CAPACITY
protected static final int INITIAL_CAPACITY
- See Also:
- Constant Field Values
-
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
-
-
Method Detail
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
setFeature
public void setFeature(String name, boolean state) throws XmlPullParserException
This allows to change name iterning property in this enhanced impl.- Specified by:
setFeaturein interfaceXmlPullParser- Overrides:
setFeaturein classMXParser- Parameters:
name- a Stringstate- a boolean- Throws:
XmlPullParserException- If the feature is not supported or can not be set
-
getFeature
public boolean getFeature(String name)
Description copied from class:MXParserUnknown properties are always returned as false- Specified by:
getFeaturein interfaceXmlPullParser- Overrides:
getFeaturein classMXParser- 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.
-
newString
protected String newString(char[] cbuf, int off, int len)
If feature name interning is enabled then this funtion MUST return interned string.
-
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:
newStringInternin classMXParser
-
initStringCache
protected void initStringCache()
-
resetStringCache
protected void resetStringCache()
- Overrides:
resetStringCachein classMXParser
-
-