List of usage examples for org.apache.lucene.util.packed PackedInts checkVersion
public static void checkVersion(int version)
From source file:com.lucure.core.codec.ForUtil.java
License:Apache License
/** * Restore a {@link ForUtil} from a {@link DataInput}. */// ww w . ja va 2 s .c o m ForUtil(DataInput in) throws IOException { int packedIntsVersion = in.readVInt(); PackedInts.checkVersion(packedIntsVersion); encodedSizes = new int[33]; encoders = new PackedInts.Encoder[33]; decoders = new PackedInts.Decoder[33]; iterations = new int[33]; for (int bpv = 1; bpv <= 32; ++bpv) { final int code = in.readVInt(); final int formatId = code >>> 5; final int bitsPerValue = (code & 31) + 1; final PackedInts.Format format = PackedInts.Format.byId(formatId); assert format.isSupported(bitsPerValue); encodedSizes[bpv] = encodedSize(format, packedIntsVersion, bitsPerValue); encoders[bpv] = PackedInts.getEncoder(format, packedIntsVersion, bitsPerValue); decoders[bpv] = PackedInts.getDecoder(format, packedIntsVersion, bitsPerValue); iterations[bpv] = computeIterations(decoders[bpv]); } }