Save This Page
Home » lucene-2.4.1-src » org.apache » lucene » index » [javadoc | source]
org.apache.lucene.index
public class: Payload [javadoc | source]
java.lang.Object
   org.apache.lucene.index.Payload

All Implemented Interfaces:
    Cloneable, Serializable

A Payload is metadata that can be stored together with each occurrence of a term. This metadata is stored inline in the posting list of the specific term.

To store payloads in the index a TokenStream has to be used that produces Token s containing payload data.

Use TermPositions#getPayloadLength() and TermPositions#getPayload(byte[], int) to retrieve the payloads from the index.
Field Summary
protected  byte[] data    the byte array containing the payload data 
protected  int offset    the offset within the byte array 
protected  int length    the length of the payload data 
Constructor:
 public Payload() 
 public Payload(byte[] data) 
 public Payload(byte[] data,
    int offset,
    int length) 
Method from org.apache.lucene.index.Payload Summary:
byteAt,   clone,   copyTo,   equals,   getData,   getOffset,   hashCode,   length,   setData,   setData,   toByteArray
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.index.Payload Detail:
 public byte byteAt(int index) 
    Returns the byte at the given index.
 public Object clone() 
    Clones this payload by creating a copy of the underlying byte array.
 public  void copyTo(byte[] target,
    int targetOffset) 
    Copies the payload data to a byte array.
 public boolean equals(Object obj) 
 public byte[] getData() 
    Returns a reference to the underlying byte array that holds this payloads data.
 public int getOffset() 
    Returns the offset in the underlying byte array
 public int hashCode() 
 public int length() 
    Returns the length of the payload data.
 public  void setData(byte[] data) 
    Sets this payloads data. A reference to the passed-in array is held, i. e. no copy is made.
 public  void setData(byte[] data,
    int offset,
    int length) 
    Sets this payloads data. A reference to the passed-in array is held, i. e. no copy is made.
 public byte[] toByteArray() 
    Allocates a new byte array, copies the payload data into it and returns it.