Package org.apache.lucene.util.packed

# Interface PackedInts.Encoder

Enclosing class:
  `PackedInts`

public static interface PackedInts.Encoder
An encoder for packed integers.

## Method Summary

Modifier and Type
Method
Description
`int`
`byteBlockCount()`
The minimum number of byte blocks to encode in a single iteration, when using byte encoding.
`int`
`byteValueCount()`
The number of values that can be stored in `byteBlockCount()` byte blocks.
`void`
`encode(int[] values, int valuesOffset, byte[] blocks, int blocksOffset, int iterations)`
Read `iterations * valueCount()` values from `values`, encode them and write `8 * iterations * blockCount()` blocks into `blocks`.
`void`
`encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations)`
Read `iterations * valueCount()` values from `values`, encode them and write `iterations * blockCount()` blocks into `blocks`.
`void`
`encode(long[] values, int valuesOffset, byte[] blocks, int blocksOffset, int iterations)`
Read `iterations * valueCount()` values from `values`, encode them and write `8 * iterations * blockCount()` blocks into `blocks`.
`void`
`encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations)`
Read `iterations * valueCount()` values from `values`, encode them and write `iterations * blockCount()` blocks into `blocks`.
`int`
`longBlockCount()`
The minimum number of long blocks to encode in a single iteration, when using long encoding.
`int`
`longValueCount()`
The number of values that can be stored in `longBlockCount()` long blocks.

## Method Details

### longBlockCount

int longBlockCount()
The minimum number of long blocks to encode in a single iteration, when using long encoding.

### longValueCount

int longValueCount()
The number of values that can be stored in `longBlockCount()` long blocks.

### byteBlockCount

int byteBlockCount()
The minimum number of byte blocks to encode in a single iteration, when using byte encoding.

### byteValueCount

int byteValueCount()
The number of values that can be stored in `byteBlockCount()` byte blocks.

### encode

void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations)
Read `iterations * valueCount()` values from `values`, encode them and write `iterations * blockCount()` blocks into `blocks`.

Parameters:
  `values` - the values buffer
  `valuesOffset` - the offset where to start reading values
  `blocks` - the long blocks that hold packed integer values
  `blocksOffset` - the offset where to start writing blocks
  `iterations` - controls how much data to encode

### encode

void encode(long[] values, int valuesOffset, byte[] blocks, int blocksOffset, int iterations)
Read `iterations * valueCount()` values from `values`, encode them and write `8 * iterations * blockCount()` blocks into `blocks`.

Parameters:
  `values` - the values buffer
  `valuesOffset` - the offset where to start reading values
  `blocks` - the long blocks that hold packed integer values
  `blocksOffset` - the offset where to start writing blocks
  `iterations` - controls how much data to encode

### encode

void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations)
Read `iterations * valueCount()` values from `values`, encode them and write `iterations * blockCount()` blocks into `blocks`.

Parameters:
  `values` - the values buffer
  `valuesOffset` - the offset where to start reading values
  `blocks` - the long blocks that hold packed integer values
  `blocksOffset` - the offset where to start writing blocks
  `iterations` - controls how much data to encode

### encode

void encode(int[] values, int valuesOffset, byte[] blocks, int blocksOffset, int iterations)
Read `iterations * valueCount()` values from `values`, encode them and write `8 * iterations * blockCount()` blocks into `blocks`.

Parameters:
  `values` - the values buffer
  `valuesOffset` - the offset where to start reading values
  `blocks` - the long blocks that hold packed integer values
  `blocksOffset` - the offset where to start writing blocks
  `iterations` - controls how much data to encode