/** * Get a {@link Decoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return a decoder */ public static Decoder getDecoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Get an {@link Encoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return an encoder */ public static Encoder getEncoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Expert: Restore a {@link ReaderIterator} from a stream without reading * metadata at the beginning of the stream. This method is useful to restore * data from streams which have been created using * {@link PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int)}. * * @param in the stream to read data from, positioned at the beginning of the packed values * @param format the format used to serialize * @param version the version used to serialize the data * @param valueCount how many values the stream holds * @param bitsPerValue the number of bits per value * @param mem how much memory the iterator is allowed to use to read-ahead (likely to speed up iteration) * @return a ReaderIterator * @see PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int) * @lucene.internal */ public static ReaderIterator getReaderIteratorNoHeader(DataInput in, Format format, int version, int valueCount, int bitsPerValue, int mem) { checkVersion(version); return new PackedReaderIterator(format, version, valueCount, bitsPerValue, in, mem); }
/** * Expert: Construct a direct {@link Reader} from a stream without reading * metadata at the beginning of the stream. This method is useful to restore * data from streams which have been created using * {@link PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int)}. * <p> * The returned reader will have very little memory overhead, but every call * to {@link Reader#get(int)} is likely to perform a disk seek. * * @param in the stream to read data from * @param format the format used to serialize * @param version the version used to serialize the data * @param valueCount how many values the stream holds * @param bitsPerValue the number of bits per value * @return a direct Reader * @lucene.internal */ public static Reader getDirectReaderNoHeader(final IndexInput in, Format format, int version, int valueCount, int bitsPerValue) { checkVersion(version); switch (format) { case PACKED: return new DirectPackedReader(bitsPerValue, valueCount, in); case PACKED_SINGLE_BLOCK: return new DirectPacked64SingleBlockReader(bitsPerValue, valueCount, in); default: throw new AssertionError("Unknwown format: " + format); } }
checkVersion(version); switch (format) { case PACKED_SINGLE_BLOCK:
/** * Restore a {@link ForUtil} from a {@link DataInput}. */ 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]); } }
/** * Get a {@link Decoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return a decoder */ public static Decoder getDecoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Get a {@link Decoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return a decoder */ public static Decoder getDecoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Get an {@link Encoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return an encoder */ public static Encoder getEncoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Get a {@link Decoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return a decoder */ public static Decoder getDecoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Get an {@link Encoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return an encoder */ public static Encoder getEncoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Get an {@link Encoder}. * * @param format the format used to store packed ints * @param version the compatibility version * @param bitsPerValue the number of bits per value * @return an encoder */ public static Encoder getEncoder(Format format, int version, int bitsPerValue) { checkVersion(version); return BulkOperation.of(format, bitsPerValue); }
/** * Expert: Restore a {@link ReaderIterator} from a stream without reading * metadata at the beginning of the stream. This method is useful to restore * data from streams which have been created using * {@link PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int)}. * * @param in the stream to read data from, positioned at the beginning of the packed values * @param format the format used to serialize * @param version the version used to serialize the data * @param valueCount how many values the stream holds * @param bitsPerValue the number of bits per value * @param mem how much memory the iterator is allowed to use to read-ahead (likely to speed up iteration) * @return a ReaderIterator * @see PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int) * @lucene.internal */ public static ReaderIterator getReaderIteratorNoHeader(DataInput in, Format format, int version, int valueCount, int bitsPerValue, int mem) { checkVersion(version); return new PackedReaderIterator(format, version, valueCount, bitsPerValue, in, mem); }
/** * Expert: Restore a {@link ReaderIterator} from a stream without reading * metadata at the beginning of the stream. This method is useful to restore * data from streams which have been created using * {@link PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int)}. * * @param in the stream to read data from, positioned at the beginning of the packed values * @param format the format used to serialize * @param version the version used to serialize the data * @param valueCount how many values the stream holds * @param bitsPerValue the number of bits per value * @param mem how much memory the iterator is allowed to use to read-ahead (likely to speed up iteration) * @return a ReaderIterator * @see PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int) * @lucene.internal */ public static ReaderIterator getReaderIteratorNoHeader(DataInput in, Format format, int version, int valueCount, int bitsPerValue, int mem) { checkVersion(version); return new PackedReaderIterator(format, version, valueCount, bitsPerValue, in, mem); }
/** * Expert: Restore a {@link ReaderIterator} from a stream without reading * metadata at the beginning of the stream. This method is useful to restore * data from streams which have been created using * {@link PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int)}. * * @param in the stream to read data from, positioned at the beginning of the packed values * @param format the format used to serialize * @param version the version used to serialize the data * @param valueCount how many values the stream holds * @param bitsPerValue the number of bits per value * @param mem how much memory the iterator is allowed to use to read-ahead (likely to speed up iteration) * @return a ReaderIterator * @see PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int) * @lucene.internal */ public static ReaderIterator getReaderIteratorNoHeader(DataInput in, Format format, int version, int valueCount, int bitsPerValue, int mem) { checkVersion(version); return new PackedReaderIterator(format, version, valueCount, bitsPerValue, in, mem); }
/** * Expert: Construct a direct {@link Reader} from a stream without reading * metadata at the beginning of the stream. This method is useful to restore * data from streams which have been created using * {@link PackedInts#getWriterNoHeader(DataOutput, Format, int, int, int)}. * <p> * The returned reader will have very little memory overhead, but every call * to {@link Reader#get(int)} is likely to perform a disk seek. * * @param in the stream to read data from * @param format the format used to serialize * @param version the version used to serialize the data * @param valueCount how many values the stream holds * @param bitsPerValue the number of bits per value * @return a direct Reader * @lucene.internal */ public static Reader getDirectReaderNoHeader(final IndexInput in, Format format, int version, int valueCount, int bitsPerValue) { checkVersion(version); switch (format) { case PACKED: return new DirectPackedReader(bitsPerValue, valueCount, in); case PACKED_SINGLE_BLOCK: return new DirectPacked64SingleBlockReader(bitsPerValue, valueCount, in); default: throw new AssertionError("Unknwown format: " + format); } }
/** * Restore a {@link ForUtil} from a {@link DataInput}. */ 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]); } }
/** * Restore a {@link ForUtil} from a {@link DataInput}. */ 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]); } }
/** * Restore a {@link ForUtil} from a {@link DataInput}. */ 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]); } }
/** * Restore a {@link ForUtil} from a {@link DataInput}. */ 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]); } }