Represents byte[], as a slice (offset + length) into an existing byte[]. The
bytes
member should never be null; use EMPTY_BYTES
if necessary. Important note: Unless otherwise noted, Lucene uses this class to represent terms that are encoded as UTF8 bytes in the index. To convert them to a Java String
(which is UTF16), use utf8ToString()
. Using code like new String(bytes, offset, length)
to do this is wrong, as it does not respect the correct character set and may return wrong results (depending on the platform's defaults)!
Read full article from BytesRef (Lucene 4.0.0 API)
No comments:
Post a Comment