lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Busch <>
Subject Re: Payload API
Date Mon, 19 Nov 2007 19:42:38 GMT
Yonik Seeley wrote:
> Immutable implies that the user needs to do a new byte[] for every payload, yes?
> It seems like this would be slower if payloads were common and faster
> if very rare.

No, Payload has this ctr:
public Payload(byte[] data, int offset, int length);

So the same byte[] array can currently be used for multiple Payloads. A
TokenFilter can get the Payload object from the Token, but it can't
access the reference of the underlying byte[] array. It can however use
one of the following methods to access the payload data:

public byte byteAt(int index);
public byte[] toByteArray();
public void copyTo(byte[] target, int targetOffset);

So this way currently a TokenFilter can replace an existing payload, but
it can't get write access to the byte[] array from the caller.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message