本文整理汇总了Java中org.apache.lucene.util.packed.PackedInts.Format方法的典型用法代码示例。如果您正苦于以下问题:Java PackedInts.Format方法的具体用法?Java PackedInts.Format怎么用?Java PackedInts.Format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.packed.PackedInts
的用法示例。
在下文中一共展示了PackedInts.Format方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pforBlockSize
import org.apache.lucene.util.packed.PackedInts; //导入方法依赖的package包/类
int pforBlockSize(int bitsPerValue, int numExceptions, int bitsPerException) {
final PackedInts.Format format = PackedInts.Format.PACKED;
long blockSize = 1 // header: number of bits per value
+ format.byteCount(PackedInts.VERSION_CURRENT, BLOCK_SIZE, bitsPerValue);
if (numExceptions > 0) {
blockSize += 2 // 2 additional bytes in case of exceptions: numExceptions and bitsPerException
+ numExceptions // indices of the exceptions
+ format.byteCount(PackedInts.VERSION_CURRENT, numExceptions, bitsPerException);
}
if (bufferSize < BLOCK_SIZE) {
blockSize += 1; // length of the block
}
return (int) blockSize;
}
示例2: encodedSize
import org.apache.lucene.util.packed.PackedInts; //导入方法依赖的package包/类
/**
* Compute the number of bytes required to encode a block of values that require
* <code>bitsPerValue</code> bits per value with format <code>format</code>.
*/
private static int encodedSize(PackedInts.Format format, int packedIntsVersion, int bitsPerValue) {
final long byteCount = format.byteCount(packedIntsVersion, BLOCK_SIZE, bitsPerValue);
assert byteCount >= 0 && byteCount <= Integer.MAX_VALUE : byteCount;
return (int) byteCount;
}