public interface FixedLengthData
Each record in Hollow begins with a fixed-length number of bits. At the lowest level, these bits are held in
FixedLengthData
data structures which can be either backed by long arrays or ByteBuffers.
For example, if an EncodedLongBuffer was queried for the 6-bit value starting at bit 7 in the following example
range of bits:
0001000100100001101000010100101001111010101010010010101the value 100100 in binary, or 36 in base 10, would be returned.
As a result there two ways to obtain an element value from the bit string at a given bit index. The first,
using getElementValue(long, int)
for values less than 61 bits in length and the second, using
getLargeElementValue(long, int)
that is recommended for values of upto 64 bits in length.
Modifier and Type | Method and Description |
---|---|
static int |
bitsRequiredToRepresentValue(long value) |
void |
clearElementValue(long index,
int bitsPerElement) |
void |
copyBits(FixedLengthData copyFrom,
long sourceStartBit,
long destStartBit,
long numBits) |
static void |
discardFrom(HollowBlobInput in)
Discard fixed length data from input.
|
long |
getElementValue(long index,
int bitsPerElement)
Gets an element value, comprising of
bitsPerElement bits, at the given
bit index . |
long |
getElementValue(long index,
int bitsPerElement,
long mask)
Gets a masked element value, comprising of
bitsPerElement bits, at the given
bit index . |
long |
getLargeElementValue(long index,
int bitsPerElement)
Gets a large element value, comprising of
bitsPerElement bits, at the given
bit index . |
long |
getLargeElementValue(long index,
int bitsPerElement,
long mask)
Gets a masked large element value, comprising of
bitsPerElement bits, at the given
bit index . |
void |
incrementMany(long startBit,
long increment,
long bitsBetweenIncrements,
int numIncrements) |
void |
setElementValue(long index,
int bitsPerElement,
long value) |
long getElementValue(long index, int bitsPerElement)
bitsPerElement
bits, at the given
bit index
. bitsPerElement
should be less than 61 bits.index
- the bit indexbitsPerElement
- bits per element, must be less than 61 otherwise
the result is undefinedlong getElementValue(long index, int bitsPerElement, long mask)
bitsPerElement
bits, at the given
bit index
.index
- the bit indexbitsPerElement
- bits per element, must be less than 61 otherwise
the result is undefinedmask
- the mask to apply to an element value before it is returned.
The mask should be less than or equal to (1L << bitsPerElement) - 1
to
guarantee that one or more (possibly) partial element values occurring
before and after the desired element value are not included in the returned value.long getLargeElementValue(long index, int bitsPerElement)
bitsPerElement
bits, at the given
bit index
.
This method should be utilized if the bitsPerElement
may exceed 60
bits,
otherwise the method getLargeElementValue(long, int)
can be utilized instead.
index
- the bit indexbitsPerElement
- bits per element, may be greater than 60long getLargeElementValue(long index, int bitsPerElement, long mask)
bitsPerElement
bits, at the given
bit index
.
This method should be utilized if the bitsPerElement
may exceed 60
bits,
otherwise the method getLargeElementValue(long, int, long)
can be utilized instead.
index
- the bit indexbitsPerElement
- bits per element, may be greater than 60mask
- the mask to apply to an element value before it is returned.
The mask should be less than or equal to (1L << bitsPerElement) - 1
to
guarantee that one or more (possibly) partial element values occurring
before and after the desired element value are not included in the returned value.void setElementValue(long index, int bitsPerElement, long value)
void copyBits(FixedLengthData copyFrom, long sourceStartBit, long destStartBit, long numBits)
void incrementMany(long startBit, long increment, long bitsBetweenIncrements, int numIncrements)
void clearElementValue(long index, int bitsPerElement)
static void discardFrom(HollowBlobInput in) throws java.io.IOException
in
- Hollow Blob Input to discard data fromjava.io.IOException
static int bitsRequiredToRepresentValue(long value)