Class BytesRef
Represents byte[], as a slice (offset + length) into an
existing byte[]. The Bytes property 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 .NET 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)!
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public sealed class BytesRef : IComparable<BytesRef>, IComparable
Constructors
Name | Description |
---|---|
BytesRef() | Create a BytesRef with EMPTY_BYTES |
BytesRef(ICharSequence) | Initialize the byte[] from the UTF8 bytes for the provided ICharSequence. |
BytesRef(Byte[]) | This instance will directly reference |
BytesRef(Byte[], Int32, Int32) | This instance will directly reference |
BytesRef(Int32) | Create a BytesRef pointing to a new array of size |
BytesRef(String) | Initialize the byte[] from the UTF8 bytes
for the provided |
Fields
Name | Description |
---|---|
EMPTY_BYTES | An empty byte array for convenience |
Properties
Name | Description |
---|---|
Bytes | The contents of the BytesRef. Should never be |
Length | Length of used bytes. |
Offset | Offset of first valid byte. |
UTF8SortedAsUnicodeComparer | |
UTF8SortedAsUTF16Comparer |
Methods
Name | Description |
---|---|
Append(BytesRef) | Appends the bytes from the given BytesRef NOTE: if this would exceed the array size, this method creates a new reference array. |
BytesEquals(BytesRef) | Expert: Compares the bytes against another BytesRef,
returning @lucene.internal |
Clone() | Returns a shallow clone of this instance (the underlying bytes are not copied and will be shared by both the returned object and this object. |
CompareTo(BytesRef) | Unsigned byte order comparison |
CompareTo(Object) | Unsigned byte order comparison |
CopyBytes(BytesRef) | Copies the bytes from the given BytesRef NOTE: if this would exceed the array size, this method creates a new reference array. |
CopyChars(ICharSequence) | Copies the UTF8 bytes for this ICharSequence. |
CopyChars(String) | Copies the UTF8 bytes for this |
DeepCopyOf(BytesRef) | Creates a new BytesRef that points to a copy of the bytes from
The returned BytesRef will have a length of |
Equals(Object) | |
GetHashCode() | Calculates the hash code as required by Lucene.Net.Index.TermsHash during indexing. This is currently implemented as MurmurHash3 (32 bit), using the seed from GOOD_FAST_HASH_SEED, but is subject to change from release to release. |
Grow(Int32) | Used to grow the reference array. In general this should not be used as it does not take the offset into account. @lucene.internal |
IsValid() | Performs internal consistency checks.
Always returns true (or throws |
ToString() | Returns hex encoded bytes, eg [0x6c 0x75 0x63 0x65 0x6e 0x65] |
Utf8ToString() | Interprets stored bytes as UTF8 bytes, returning the
resulting |