Package me.lemire.integercompression
Class DeltaZigzagVariableByte
java.lang.Object
me.lemire.integercompression.DeltaZigzagVariableByte
- All Implemented Interfaces:
IntegerCODEC
VariableByte with Delta+Zigzag Encoding.
- Author:
- MURAOKA Taro http://github.com/koron
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
compress
(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos) Compress data from an array to another array.protected ByteBuffer
makeBuffer
(int sizeInBytes) Creates a new buffer of the requested size.toString()
void
uncompress
(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos) Uncompress data from an array to another array.
-
Constructor Details
-
DeltaZigzagVariableByte
public DeltaZigzagVariableByte()
-
-
Method Details
-
toString
-
compress
Description copied from interface:IntegerCODEC
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 ints (inlength = 12) are compressed to 3 ints, then inpos will be incremented by 12 while outpos will be incremented by 3. We use IntWrapper to pass the values by reference.- Specified by:
compress
in interfaceIntegerCODEC
- Parameters:
inBuf
- input arrayinPos
- where to start reading in the arrayinLen
- how many integers to compressoutBuf
- output arrayoutPos
- where to write in the output array
-
uncompress
Description copied from interface:IntegerCODEC
Uncompress data from an array to another array. Both inpos and outpos parameters are modified to indicate new positions after read/write.- Specified by:
uncompress
in interfaceIntegerCODEC
- Parameters:
inBuf
- array containing data in compressed forminPos
- where to start reading in the arrayinLen
- length of the compressed data (ignored by some schemes)outBuf
- array where to write the compressed outputoutPos
- where to start writing the uncompressed output in out
-
makeBuffer
Creates a new buffer of the requested size. In case you need a different way to allocate buffers, you can override this method with a custom behavior. The default implementation allocates a new Java directByteBuffer
on each invocation.- Parameters:
sizeInBytes
-- Returns:
-