Package org.apache.lucene.codecs

# Class CompoundFormat

java.lang.Object
org.apache.lucene.codecs.CompoundFormat

Direct Known Subclasses:
  `Lucene90CompoundFormat`

public abstract class CompoundFormat extends Object
Encodes/decodes compound files

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

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`CompoundFormat()`
Sole constructor.

## Method Summary

Modifier and Type
Method
Description
`abstract CompoundDirectory`
`getCompoundReader(Directory dir, SegmentInfo si, IOContext context)`
Returns a Directory view (read-only) for the compound files in this segment
`abstract void`
`write(Directory dir, SegmentInfo si, IOContext context)`
Packs the provided segment's files into a compound format.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CompoundFormat

protected CompoundFormat()
Sole constructor. (For invocation by subclass constructors, typically implicit.)

## Method Details

### getCompoundReader

public abstract CompoundDirectory getCompoundReader(Directory dir, SegmentInfo si, IOContext context) throws IOException
Returns a Directory view (read-only) for the compound files in this segment

Throws:
  `IOException`

### write

public abstract void write(Directory dir, SegmentInfo si, IOContext context) throws IOException
Packs the provided segment's files into a compound format. All files referenced by the provided `SegmentInfo` must have `CodecUtil.writeIndexHeader(org.apache.lucene.store.DataOutput, java.lang.String, int, byte[], java.lang.String)` and `CodecUtil.writeFooter(org.apache.lucene.store.IndexOutput)`.

Throws:
  `IOException`