Class IndexWriter
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.file.tar.index.IndexWriter
-
public class IndexWriter extends Object
Builds an index incrementally in memory, and serializes its contents into a sequence of bytes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(long msb, long lsb, int offset, int size, int generation, int fullGeneration, boolean isCompacted)
Add an entry to this index.static IndexWriter
newIndexWriter(int blockSize)
Create a newIndexWriter
for the specified block size.byte[]
write()
Serializes the content of the index.
-
-
-
Method Detail
-
newIndexWriter
public static IndexWriter newIndexWriter(int blockSize)
Create a newIndexWriter
for the specified block size. The block size is needed to ensure that the data produced by the returnedIndexWriter
is aligned to a specified boundary, i.e. is a multiple of the block size.- Parameters:
blockSize
- The block size. It must be strictly positive.- Returns:
- An index of
IndexWriter
.
-
addEntry
public void addEntry(long msb, long lsb, int offset, int size, int generation, int fullGeneration, boolean isCompacted)
Add an entry to this index.- Parameters:
msb
- The most significant bits of the entry identifier.lsb
- The least significant bits of the entry identifier.offset
- The position of the entry in the file.size
- The size of the entry.generation
- The generation of the entry.fullGeneration
- The full generation of the entry.isCompacted
- Whether the entry is generated as part of a compaction operation.
-
write
public byte[] write()
Serializes the content of the index. The returned array of bytes is always a multiple of the block size specified when thisIndexWriter
was created.- Returns:
- the serialized content of the index.
-
-