## org.apache.lucene.codecs.intblock
Class VariableIntBlockIndexOutput

    java.lang.Object
      org.apache.lucene.codecs.sep.IntIndexOutput
          org.apache.lucene.codecs.intblock.VariableIntBlockIndexOutput

All Implemented Interfaces:
  Closeable

    public abstract class VariableIntBlockIndexOutput

extends IntIndexOutput

Abstract base class that writes variable-size blocks of ints to an IndexOutput. While this is a simple approach, a more performant approach would directly create an impl of IntIndexOutput inside Directory. Wrapping a generic IndexInput will likely cost performance.

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

Field Summary
`protected IndexOutput` `out`

Constructor Summary
`protected` `VariableIntBlockIndexOutput(IndexOutput out, int maxBlockSize)` NOTE: maxBlockSize must be the maximum block size plus the max non-causal lookahead of your codec.

Method Summary
`protected abstract int` `add(int value)` Called one value at a time.
`void` `close()`
`IntIndexOutput.Index` `index()` If you are indexing the primary output file, call this and interact with the returned IndexWriter.
`void` `write(int v)` Write an int to the primary file.

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

Field Detail

### out

    protected final IndexOutput out

Constructor Detail

### VariableIntBlockIndexOutput

    protected VariableIntBlockIndexOutput(IndexOutput out,
                                          int maxBlockSize)
                                   throws IOException

  NOTE: maxBlockSize must be the maximum block size plus the max non-causal lookahead of your codec. EG Simple9 requires lookahead=1 because on seeing the Nth value it knows it must now encode the N-1 values before it.

  Throws:
    `IOException`

Method Detail

### add

    protected abstract int add(int value)
                        throws IOException

  Called one value at a time. Return the number of buffered input values that have been written to out.

  Throws:
    `IOException`

### index

    public IntIndexOutput.Index index()
                               throws IOException

  Description copied from class: `IntIndexOutput`
  If you are indexing the primary output file, call this and interact with the returned IndexWriter.

  Specified by:
    `index` in class `IntIndexOutput`
  Throws:
    `IOException`

### write

    public void write(int v)
               throws IOException

  Description copied from class: `IntIndexOutput`
  Write an int to the primary file. The value must be >= 0.

  Specified by:
    `write` in class `IntIndexOutput`
  Throws:
    `IOException`

### close

    public void close()
               throws IOException

  Specified by:
    `close` in interface `Closeable`
  Specified by:
    `close` in class `IntIndexOutput`
  Throws:
    `IOException`

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.