Save This Page
Home » lucene-3.0.1-src » org.apache.lucene.analysis.tokenattributes » [javadoc | source]
org.apache.lucene.analysis.tokenattributes
public interface: TermAttribute [javadoc | source]

All Implemented Interfaces:
    Attribute

All Known Implementing Classes:
    Token, TermAttributeImpl

The term text of a Token.
Method from org.apache.lucene.analysis.tokenattributes.TermAttribute Summary:
resizeTermBuffer,   setTermBuffer,   setTermBuffer,   setTermBuffer,   setTermLength,   term,   termBuffer,   termLength
Method from org.apache.lucene.analysis.tokenattributes.TermAttribute Detail:
 public char[] resizeTermBuffer(int newSize)
 public  void setTermBuffer(String buffer)
    Copies the contents of buffer into the termBuffer array.
 public  void setTermBuffer(char[] buffer,
    int offset,
    int length)
    Copies the contents of buffer, starting at offset for length characters, into the termBuffer array.
 public  void setTermBuffer(String buffer,
    int offset,
    int length)
    Copies the contents of buffer, starting at offset and continuing for length characters, into the termBuffer array.
 public  void setTermLength(int length)
    Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the termBuffer or to synchronize with external manipulation of the termBuffer. Note: to grow the size of the array, use #resizeTermBuffer(int) first.
 public String term()
    Returns the Token's term text. This method has a performance penalty because the text is stored internally in a char[]. If possible, use #termBuffer() and #termLength() directly instead. If you really need a String, use this method, which is nothing more than a convenience call to new String(token.termBuffer(), 0, token.termLength())
 public char[] termBuffer()
    Returns the internal termBuffer character array which you can then directly alter. If the array is too small for your token, use #resizeTermBuffer(int) to increase it. After altering the buffer be sure to call #setTermLength to record the number of valid characters that were placed into the termBuffer.
 public int termLength()
    Return number of valid characters (length of the term) in the termBuffer array.