XML for Java 2.0.0

com.ibm.xml.framework
Interface StringPool


public abstract interface StringPool

Version:
Revision: 48 1.6 src/com/ibm/xml/framework/StringPool.java, parser, xml4j2, xml4j2_0_0

Method Summary
 int addString(java.lang.String s)
          Add string.
 int addString(StringProducer stringProducer, int offset, int length)
           
 boolean addStringToList(int stringListIndex, int stringIndex)
          Add a string from the StringPool to a "StringList".
 int addSymbol(java.lang.String s)
          Add symbol.
 int addSymbol(StringProducer stringProducer, int offset, int length, int hashcode)
           
 void finishStringList(int stringListIndex)
          Finish a "StringList."
 java.lang.String orphanString(int stringIndex)
          Get String value.
 void releaseString(int stringIndex)
          Release index.
 void reset(ParserState parserState)
          Reset this pool for use during the next invocation of the parser.
 StringPool resetOrCopy(ParserState parserState)
          Return a pool for use during the next invocation of the parser.
 int startStringList()
          Maintain a list of strings.
 boolean stringInList(int stringListIndex, int stringIndex)
          Return true if a stringIndex (from the StringPool) is in a "StringList."
 int stringListLength(int stringListIndex)
          Return the length of a "StringList."
 int[] stringsInList(int stringListIndex)
          Given a stringListIndex return an array populated by indexes of strings in the StringPool.
 java.lang.String toString(int stringIndex)
          Get String value.
 

Method Detail

reset

public void reset(ParserState parserState)
Reset this pool for use during the next invocation of the parser.

resetOrCopy

public StringPool resetOrCopy(ParserState parserState)
Return a pool for use during the next invocation of the parser.

addString

public int addString(java.lang.String s)
Add string. Assign a new index to this string. Two matching strings have different string indexes. Used for most "values".

addString

public int addString(StringProducer stringProducer,
                     int offset,
                     int length)

addSymbol

public int addSymbol(java.lang.String s)
Add symbol. Assign a string index to each unique symbol string. Two matching symbols have the same string index. Used for Element, Attribute and Entity names.

addSymbol

public int addSymbol(StringProducer stringProducer,
                     int offset,
                     int length,
                     int hashcode)

startStringList

public int startStringList()
Maintain a list of strings. Used for name, nmtoken, notation and enumeration lists.

addStringToList

public boolean addStringToList(int stringListIndex,
                               int stringIndex)
Add a string from the StringPool to a "StringList".

finishStringList

public void finishStringList(int stringListIndex)
Finish a "StringList."

stringListLength

public int stringListLength(int stringListIndex)
Return the length of a "StringList."

stringInList

public boolean stringInList(int stringListIndex,
                            int stringIndex)
Return true if a stringIndex (from the StringPool) is in a "StringList."

stringsInList

public int[] stringsInList(int stringListIndex)
Given a stringListIndex return an array populated by indexes of strings in the StringPool.

releaseString

public void releaseString(int stringIndex)
Release index. All resources associated with stringIndex will be released and the index can be reused.

toString

public java.lang.String toString(int stringIndex)
Get String value. Cache the result. Used for both Strings and Symbols

orphanString

public java.lang.String orphanString(int stringIndex)
Get String value. All resources associated with stringIndex will be released and the index can be reused. Optimized form of toString followed by releaseString that eliminates an wasteful caching operation.

XML for Java 2.0.0