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.

-Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to