Show / Hide Table of Contents

    Class IndexableBinaryStringTools

    Provides support for converting byte sequences to System.Strings and back again. The resulting System.Strings preserve the original byte sequences' sort order.

    The System.Strings are constructed using a Base 8000h encoding of the original binary data - each char of an encoded System.String represents a 15-bit chunk from the byte sequence. Base 8000h was chosen because it allows for all lower 15 bits of char to be used without restriction; the surrogate range [U+D8000-U+DFFF] does not represent valid chars, and would require complicated handling to avoid them and allow use of char's high bit.

    Although unset bits are used as padding in the final char, the original byte sequence could contain trailing bytes with no set bits (null bytes): padding is indistinguishable from valid information. To overcome this problem, a char is appended, indicating the number of encoded bytes in the final content char.

    @lucene.experimental

    Inheritance
    System.Object
    IndexableBinaryStringTools
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Util
    Assembly: Lucene.Net.dll
    Syntax
    [Obsolete("Implement Analysis.TokenAttributes.ITermToBytesRefAttribute and store bytes directly instead. this class will be removed in Lucene 5.0")]
    public sealed class IndexableBinaryStringTools

    Methods

    | Improve this Doc View Source

    Decode(Char[], Int32, Int32, Byte[], Int32, Int32)

    Decodes the input System.Char sequence into the output System.Byte sequence. Before calling this method, ensure that the output array has sufficient capacity by calling GetDecodedLength(Char[], Int32, Int32).

    Declaration
    public static void Decode(char[] inputArray, int inputOffset, int inputLength, byte[] outputArray, int outputOffset, int outputLength)
    Parameters
    Type Name Description
    System.Char[] inputArray

    System.Char sequence to be decoded

    System.Int32 inputOffset

    Initial offset into inputArray

    System.Int32 inputLength

    Number of chars in inputArray

    System.Byte[] outputArray

    System.Byte sequence to store encoded result

    System.Int32 outputOffset

    Initial offset into outputArray

    System.Int32 outputLength

    Length of output, must be GetDecodedLength(inputArray, inputOffset, inputLength)

    | Improve this Doc View Source

    Decode(Char[], Int32, Int32, SByte[], Int32, Int32)

    Decodes the input char sequence into the output sbyte sequence. Before calling this method, ensure that the output array has sufficient capacity by calling GetDecodedLength(Char[], Int32, Int32).

    Declaration
    [CLSCompliant(false)]
    public static void Decode(char[] inputArray, int inputOffset, int inputLength, sbyte[] outputArray, int outputOffset, int outputLength)
    Parameters
    Type Name Description
    System.Char[] inputArray

    System.Char sequence to be decoded

    System.Int32 inputOffset

    Initial offset into inputArray

    System.Int32 inputLength

    Number of chars in inputArray

    System.SByte[] outputArray

    System.Byte sequence to store encoded result

    System.Int32 outputOffset

    Initial offset into outputArray

    System.Int32 outputLength

    Length of output, must be GetDecodedLength(inputArray, inputOffset, inputLength)

    | Improve this Doc View Source

    Encode(Byte[], Int32, Int32, Char[], Int32, Int32)

    Encodes the input System.Byte sequence into the output char sequence. Before calling this method, ensure that the output array has sufficient capacity by calling GetEncodedLength(Byte[], Int32, Int32).

    Declaration
    public static void Encode(byte[] inputArray, int inputOffset, int inputLength, char[] outputArray, int outputOffset, int outputLength)
    Parameters
    Type Name Description
    System.Byte[] inputArray

    System.Byte sequence to be encoded

    System.Int32 inputOffset

    Initial offset into inputArray

    System.Int32 inputLength

    Number of bytes in inputArray

    System.Char[] outputArray

    System.Char sequence to store encoded result

    System.Int32 outputOffset

    Initial offset into outputArray

    System.Int32 outputLength

    Length of output, must be GetEncodedLength(inputArray, inputOffset, inputLength)

    | Improve this Doc View Source

    Encode(SByte[], Int32, Int32, Char[], Int32, Int32)

    Encodes the input System.SByte sequence into the output char sequence. Before calling this method, ensure that the output array has sufficient capacity by calling GetEncodedLength(SByte[], Int32, Int32).

    Declaration
    [CLSCompliant(false)]
    public static void Encode(sbyte[] inputArray, int inputOffset, int inputLength, char[] outputArray, int outputOffset, int outputLength)
    Parameters
    Type Name Description
    System.SByte[] inputArray

    System.SByte sequence to be encoded

    System.Int32 inputOffset

    Initial offset into inputArray

    System.Int32 inputLength

    Number of bytes in inputArray

    System.Char[] outputArray

    System.Char sequence to store encoded result

    System.Int32 outputOffset

    Initial offset into outputArray

    System.Int32 outputLength

    Length of output, must be getEncodedLength

    | Improve this Doc View Source

    GetDecodedLength(Char[], Int32, Int32)

    Returns the number of System.Bytes required to decode the given char sequence.

    Declaration
    public static int GetDecodedLength(char[] encoded, int offset, int length)
    Parameters
    Type Name Description
    System.Char[] encoded

    Char sequence to be decoded

    System.Int32 offset

    Initial offset

    System.Int32 length

    Number of characters

    Returns
    Type Description
    System.Int32

    The number of System.Bytes required to decode the given char sequence

    | Improve this Doc View Source

    GetEncodedLength(Byte[], Int32, Int32)

    Returns the number of chars required to encode the given System.Bytes.

    Declaration
    public static int GetEncodedLength(byte[] inputArray, int inputOffset, int inputLength)
    Parameters
    Type Name Description
    System.Byte[] inputArray

    Byte sequence to be encoded

    System.Int32 inputOffset

    Initial offset into inputArray

    System.Int32 inputLength

    Number of bytes in inputArray

    Returns
    Type Description
    System.Int32

    The number of chars required to encode the number of System.Bytes.

    | Improve this Doc View Source

    GetEncodedLength(SByte[], Int32, Int32)

    Returns the number of chars required to encode the given System.SBytes.

    Declaration
    [CLSCompliant(false)]
    public static int GetEncodedLength(sbyte[] inputArray, int inputOffset, int inputLength)
    Parameters
    Type Name Description
    System.SByte[] inputArray

    System.SByte sequence to be encoded

    System.Int32 inputOffset

    Initial offset into inputArray

    System.Int32 inputLength

    Number of sbytes in inputArray

    Returns
    Type Description
    System.Int32

    The number of chars required to encode the number of System.SBytes.

    Extension Methods

    Number.IsNumber(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Licensed to the Apache Software Foundation (ASF)