EightFlagsIntEncoder (Lucene 3.6.2 API)
Keywords: org.apache.lucene.util.encoding.EightFlagsIntEncoder class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.util.encoding
Class EightFlagsIntEncoder

    java.lang.Object
      org.apache.lucene.util.encoding.IntEncoder
          org.apache.lucene.util.encoding.ChunksIntEncoder
              org.apache.lucene.util.encoding.EightFlagsIntEncoder

    public class EightFlagsIntEncoder

extends ChunksIntEncoder

A `ChunksIntEncoder` which encodes data in chunks of 8. Every group starts with a single byte (called indicator) which represents 8 - 1 bit flags, where the value:

- 1 means the encoded value is '1'
- 0 means the value is encoded using `VInt8IntEncoder`, and the encoded bytes follow the indicator.
  Since value 0 is illegal, and 1 is encoded in the indicator, the actual value that is encoded is `value-2`, which saves some more bits.

Encoding example:

- Original values: 6, 16, 5, 9, 7, 1
- After sorting: 1, 5, 6, 7, 9, 16
- D-Gap computing: 1, 4, 1, 1, 2, 5 (so far - done by `DGapIntEncoder`)
- Encoding: 1,0,1,1,0,0,0,0 as the indicator, by 2 (4-2), 0 (2-2), 3 (5-2).
- Binary encode: 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 00000010 00000000 00000011 (indicator is underlined).
  NOTE: the order of the values in the indicator is lsb ⇒ msb, which allows for more efficient decoding.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary

Fields inherited from class org.apache.lucene.util.encoding.ChunksIntEncoder
`encodeQueue, encodeQueueSize, encoder, indicator, ordinal`

Fields inherited from class org.apache.lucene.util.encoding.IntEncoder
`out`

Constructor Summary
`EightFlagsIntEncoder()`

Method Summary
`IntDecoder` | `createMatchingDecoder()` Returns an `IntDecoder` which matches this encoder.
`void` | `encode(int data)` Encodes an integer to the output stream given in `reInit`
`String` | `toString()`

Methods inherited from class org.apache.lucene.util.encoding.ChunksIntEncoder
`close, encodeChunk, reInit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### EightFlagsIntEncoder

    public EightFlagsIntEncoder()

Method Detail

### encode

    public void encode(int data)
                throws IOException

  Description copied from class: `IntEncoder`
  Encodes an integer to the output stream given in `reInit`

  Specified by:
    `encode` in class `IntEncoder`
  Throws:
    `IOException`

### createMatchingDecoder

    public IntDecoder createMatchingDecoder()

  Description copied from class: `IntEncoder`
  Returns an `IntDecoder` which matches this encoder. Every encoder must return an `IntDecoder` and `null` is not a valid value. If an encoder is just a filter, it should at least return its wrapped encoder's matching decoder.

  NOTE: this method should create a new instance of the matching decoder and leave the instance sharing to the caller. Returning the same instance over and over is risky because encoders and decoders are not thread safe.

  Specified by:
    `createMatchingDecoder` in class `IntEncoder`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD