|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.index.Payload
public class Payload
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 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 |
length
the length of the payload data |
protected int |
offset
the offset within the byte array |
Constructor Summary | |
---|---|
Payload()
Creates an empty payload and does not allocate a byte array. |
|
Payload(byte[] data)
Creates a new payload with the the given array as data. |
|
Payload(byte[] data,
int offset,
int length)
Creates a new payload with the the given array as data. |
Method Summary | |
---|---|
byte |
byteAt(int index)
Returns the byte at the given index. |
Object |
clone()
Clones this payload by creating a copy of the underlying byte array. |
void |
copyTo(byte[] target,
int targetOffset)
Copies the payload data to a byte array. |
boolean |
equals(Object obj)
|
byte[] |
getData()
Returns a reference to the underlying byte array that holds this payloads data. |
int |
getOffset()
Returns the offset in the underlying byte array |
int |
hashCode()
|
int |
length()
Returns the length of the payload data. |
void |
setData(byte[] data)
Sets this payloads data. |
void |
setData(byte[] data,
int offset,
int length)
Sets this payloads data. |
byte[] |
toByteArray()
Allocates a new byte array, copies the payload data into it and returns it. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte[] data
protected int offset
protected int length
Constructor Detail |
---|
public Payload()
public Payload(byte[] data)
data
- the data of this payloadpublic Payload(byte[] data, int offset, int length)
data
- the data of this payloadoffset
- the offset in the data byte arraylength
- the length of the dataMethod Detail |
---|
public void setData(byte[] data)
public void setData(byte[] data, int offset, int length)
public byte[] getData()
public int getOffset()
public int length()
public byte byteAt(int index)
public byte[] toByteArray()
public void copyTo(byte[] target, int targetOffset)
target
- the target byte arraytargetOffset
- the offset in the target byte arraypublic Object clone()
clone
in class Object
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |