Package org.apache.lucene.util
Class IndexableBinaryStringTools
- java.lang.Object
-
- org.apache.lucene.util.IndexableBinaryStringTools
-
@Deprecated public final class IndexableBinaryStringTools extends java.lang.Object
Deprecated.ImplementTermToBytesRefAttribute
and store bytes directly instead. This class will be removed in Lucene 5.0Provides support for converting byte sequences to Strings and back again. The resulting Strings preserve the original byte sequences' sort order. The Strings are constructed using a Base 8000h encoding of the original binary data - each char of an encoded 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.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
decode(char[] inputArray, int inputOffset, int inputLength, byte[] outputArray, int outputOffset, int outputLength)
Deprecated.Decodes the input char sequence into the output byte sequence.static void
encode(byte[] inputArray, int inputOffset, int inputLength, char[] outputArray, int outputOffset, int outputLength)
Deprecated.Encodes the input byte sequence into the output char sequence.static int
getDecodedLength(char[] encoded, int offset, int length)
Deprecated.Returns the number of bytes required to decode the given char sequence.static int
getEncodedLength(byte[] inputArray, int inputOffset, int inputLength)
Deprecated.Returns the number of chars required to encode the given bytes.
-
-
-
Method Detail
-
getEncodedLength
public static int getEncodedLength(byte[] inputArray, int inputOffset, int inputLength)
Deprecated.Returns the number of chars required to encode the given bytes.- Parameters:
inputArray
- byte sequence to be encodedinputOffset
- initial offset into inputArrayinputLength
- number of bytes in inputArray- Returns:
- The number of chars required to encode the number of bytes.
-
getDecodedLength
public static int getDecodedLength(char[] encoded, int offset, int length)
Deprecated.Returns the number of bytes required to decode the given char sequence.- Parameters:
encoded
- char sequence to be decodedoffset
- initial offsetlength
- number of characters- Returns:
- The number of bytes required to decode the given char sequence
-
encode
public static void encode(byte[] inputArray, int inputOffset, int inputLength, char[] outputArray, int outputOffset, int outputLength)
Deprecated.Encodes the input byte sequence into the output char sequence. Before calling this method, ensure that the output array has sufficient capacity by callinggetEncodedLength(byte[], int, int)
.- Parameters:
inputArray
- byte sequence to be encodedinputOffset
- initial offset into inputArrayinputLength
- number of bytes in inputArrayoutputArray
- char sequence to store encoded resultoutputOffset
- initial offset into outputArrayoutputLength
- length of output, must be getEncodedLength
-
decode
public static void decode(char[] inputArray, int inputOffset, int inputLength, byte[] outputArray, int outputOffset, int outputLength)
Deprecated.Decodes the input char sequence into the output byte sequence. Before calling this method, ensure that the output array has sufficient capacity by callinggetDecodedLength(char[], int, int)
.- Parameters:
inputArray
- char sequence to be decodedinputOffset
- initial offset into inputArrayinputLength
- number of chars in inputArrayoutputArray
- byte sequence to store encoded resultoutputOffset
- initial offset into outputArrayoutputLength
- length of output, must be getDecodedLength(inputArray, inputOffset, inputLength)
-
-