Package me.lemire.longcompression
Class LongAs2IntsCodec
java.lang.Object
me.lemire.longcompression.LongAs2IntsCodec
-
Constructor Summary
ConstructorsConstructorDescriptionBy default, we expect longs to be slightly above Integer.MAX_VALUE.LongAs2IntsCodec
(IntegerCODEC highPartsCodec, IntegerCODEC lowPartsCodec) -
Method Summary
Modifier and TypeMethodDescriptionvoid
compress
(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) Compress data from an array to another array.void
uncompress
(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) inlength is ignored by this codec.
-
Constructor Details
-
LongAs2IntsCodec
-
LongAs2IntsCodec
public LongAs2IntsCodec()By default, we expect longs to be slightly above Integer.MAX_VALUE. Hence highParts to be small and positive integers. For lowParts, we rely onIntCompressor
default IntegerCODEC
-
-
Method Details
-
compress
Description copied from interface:LongCODEC
Compress data from an array to another array. Both inpos and outpos are modified to represent how much data was read and written to. If 12 longs (inlength = 12) are compressed to 3 longs, then inpos will be incremented by 12 while outpos will be incremented by 3. We use IntWrapper to pass the values by reference. -
uncompress
inlength is ignored by this codec. We may rely on it instead of storing the compressedLowPart length- Specified by:
uncompress
in interfaceLongCODEC
- Parameters:
in
- array containing data in compressed forminpos
- where to start reading in the arrayinlength
- length of the compressed data (ignored by some schemes)out
- array where to write the uncompressed outputoutpos
- where to start writing the uncompressed output in out
-