Package org.apache.lucene.util
Class GroupVIntUtil
java.lang.Object
org.apache.lucene.util.GroupVIntUtil
This class contains utility methods and constants for group varint
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvides an abstraction for read int values, so that decoding logic can be reused in different DataInput. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidreadGroupVInt(DataInput in, int[] dst, int offset) Default implementation of read single group, for optimal performance, you should usereadGroupVInts(DataInput, int[], int)instead.static voidreadGroupVInt(DataInput in, long[] dst, int offset) Default implementation of read single group, for optimal performance, you should usereadGroupVInts(DataInput, long[], int)instead.static intreadGroupVInt(DataInput in, long remaining, GroupVIntUtil.IntReader reader, long pos, int[] dst, int offset) Faster implementation of read single group, It read values from the buffer that would not cross boundaries.static intreadGroupVInt(DataInput in, long remaining, GroupVIntUtil.IntReader reader, long pos, long[] dst, int offset) Faster implementation of read single group, It read values from the buffer that would not cross boundaries.static voidreadGroupVInts(DataInput in, int[] dst, int limit) Read all the group varints, including the tail vints.static voidreadGroupVInts(DataInput in, long[] dst, int limit) Read all the group varints, including the tail vints.static voidwriteGroupVInts(DataOutput out, byte[] scratch, int[] values, int limit) The implementation for group-varint encoding, It uses a maximum ofMAX_LENGTH_PER_GROUPbytes scratch buffer.static voidwriteGroupVInts(DataOutput out, byte[] scratch, long[] values, int limit) The implementation for group-varint encoding, It uses a maximum ofMAX_LENGTH_PER_GROUPbytes scratch buffer.
-
Field Details
-
MAX_LENGTH_PER_GROUP
public static final int MAX_LENGTH_PER_GROUP- See Also:
-
-
Constructor Details
-
GroupVIntUtil
public GroupVIntUtil()
-
-
Method Details
-
readGroupVInts
Read all the group varints, including the tail vints. we need a long[] because this is what postings are using, all longs are actually required to be integers.- Parameters:
dst- the array to read ints into.limit- the number of int values to read.- Throws:
IOException- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
readGroupVInts
Read all the group varints, including the tail vints.- Parameters:
dst- the array to read ints into.limit- the number of int values to read.- Throws:
IOException- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
readGroupVInt
Default implementation of read single group, for optimal performance, you should usereadGroupVInts(DataInput, long[], int)instead.- Parameters:
in- the input to use to read data.dst- the array to read ints into.offset- the offset in the array to start storing ints.- Throws:
IOException
-
readGroupVInt
Default implementation of read single group, for optimal performance, you should usereadGroupVInts(DataInput, int[], int)instead.- Parameters:
in- the input to use to read data.dst- the array to read ints into.offset- the offset in the array to start storing ints.- Throws:
IOException
-
readGroupVInt
public static int readGroupVInt(DataInput in, long remaining, GroupVIntUtil.IntReader reader, long pos, long[] dst, int offset) throws IOException Faster implementation of read single group, It read values from the buffer that would not cross boundaries.- Parameters:
in- the input to use to read data.remaining- the number of remaining bytes allowed to read for current block/segment.reader- the supplier of read int.pos- the start pos to read from the reader.dst- the array to read ints into.offset- the offset in the array to start storing ints.- Returns:
- the number of bytes read excluding the flag. this indicates the number of positions
should to be increased for caller, it is 0 or positive number and less than
MAX_LENGTH_PER_GROUP - Throws:
IOException
-
readGroupVInt
public static int readGroupVInt(DataInput in, long remaining, GroupVIntUtil.IntReader reader, long pos, int[] dst, int offset) throws IOException Faster implementation of read single group, It read values from the buffer that would not cross boundaries.- Parameters:
in- the input to use to read data.remaining- the number of remaining bytes allowed to read for current block/segment.reader- the supplier of read int.pos- the start pos to read from the reader.dst- the array to read ints into.offset- the offset in the array to start storing ints.- Returns:
- the number of bytes read excluding the flag. this indicates the number of positions
should to be increased for caller, it is 0 or positive number and less than
MAX_LENGTH_PER_GROUP - Throws:
IOException
-
writeGroupVInts
public static void writeGroupVInts(DataOutput out, byte[] scratch, long[] values, int limit) throws IOException The implementation for group-varint encoding, It uses a maximum ofMAX_LENGTH_PER_GROUPbytes scratch buffer.- Throws:
IOException
-
writeGroupVInts
public static void writeGroupVInts(DataOutput out, byte[] scratch, int[] values, int limit) throws IOException The implementation for group-varint encoding, It uses a maximum ofMAX_LENGTH_PER_GROUPbytes scratch buffer.- Throws:
IOException
-