|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.packed.PackedInts
public class PackedInts
Simplistic compression for array of unsigned long values. Each value is >= 0 and <= a specified maximum value. The values are stored as packed ints, with each value consuming a fixed number of bits.
Nested Class Summary | |
---|---|
static interface |
PackedInts.Mutable
A packed integer array that can be modified. |
static interface |
PackedInts.Reader
A read-only random access array of positive integers. |
static class |
PackedInts.ReaderImpl
A simple base for Readers that keeps track of valueCount and bitsPerValue. |
static class |
PackedInts.Writer
A write-once Writer. |
Constructor Summary | |
---|---|
PackedInts()
|
Method Summary | |
---|---|
static int |
bitsRequired(long maxValue)
Returns how many bits are required to hold values up to and including maxValue |
static PackedInts.Mutable |
getMutable(int valueCount,
int bitsPerValue)
Create a packed integer array with the given amount of values initialized to 0. |
static int |
getNextFixedSize(int bitsPerValue)
Rounds bitsPerValue up to 8, 16, 32 or 64. |
static PackedInts.Reader |
getReader(DataInput in)
Retrieve PackedInt data from the DataInput and return a packed int structure based on it. |
static int |
getRoundedFixedSize(int bitsPerValue)
Possibly wastes some storage in exchange for faster lookups |
static PackedInts.Writer |
getWriter(DataOutput out,
int valueCount,
int bitsPerValue)
Create a packed integer array writer for the given number of values at the given bits/value. |
static long |
maxValue(int bitsPerValue)
Calculates the maximum unsigned long that can be expressed with the given number of bits. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PackedInts()
Method Detail |
---|
public static PackedInts.Reader getReader(DataInput in) throws IOException
in
- positioned at the beginning of a stored packed int structure.
IOException
- if the structure could not be retrieved.public static PackedInts.Mutable getMutable(int valueCount, int bitsPerValue)
valueCount
- the number of elements.bitsPerValue
- the number of bits available for any given value.
IOException
- if the Mutable could not be created. With the
current implementations, this never happens, but the method
signature allows for future persistence-backed Mutables.public static PackedInts.Writer getWriter(DataOutput out, int valueCount, int bitsPerValue) throws IOException
out
- the destination for the produced bits.valueCount
- the number of elements.bitsPerValue
- the number of bits available for any given value.
IOException
- if bits could not be written to out.public static int bitsRequired(long maxValue)
maxValue
- the maximum value that should be representable.
public static long maxValue(int bitsPerValue)
bitsPerValue
- the number of bits available for any given value.
public static int getNextFixedSize(int bitsPerValue)
public static int getRoundedFixedSize(int bitsPerValue)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |