public class OffsetCheckpoint extends Object implements Closeable
<version> <n> <topic_name_1> <partition_1> <offset_1> . . . <topic_name_n> <partition_n> <offset_n>The first line contains a number designating the format version (currently 0), the get line contains a number giving the total number of offsets. Each successive line gives a topic/partition/offset triple separated by spaces.
| Modifier and Type | Field and Description |
|---|---|
static String |
CHECKPOINT_FILE_NAME |
protected File |
file |
static String |
LOCK_FILE_NAME |
| Constructor and Description |
|---|
OffsetCheckpoint(String checkpointDir,
int version,
String topic) |
| Modifier and Type | Method and Description |
|---|---|
protected File |
baseDir(String checkpointDir,
String topic) |
void |
close() |
void |
delete() |
Map<org.apache.kafka.common.TopicPartition,Long> |
read()
Reads the offsets from the local checkpoint file, skipping any negative offsets it finds.
|
protected void |
setUpLockFile(File baseDir) |
String |
toString() |
void |
write(Map<org.apache.kafka.common.TopicPartition,Long> offsets)
Write the given offsets to the checkpoint file.
|
public static final String CHECKPOINT_FILE_NAME
public static final String LOCK_FILE_NAME
protected final File file
public OffsetCheckpoint(String checkpointDir, int version, String topic) throws IOException
IOExceptionprotected void setUpLockFile(File baseDir) throws IOException
IOExceptionprotected File baseDir(String checkpointDir, String topic) throws IOException
IOExceptionpublic void write(Map<org.apache.kafka.common.TopicPartition,Long> offsets) throws IOException
IOException - if any file operation fails with an IO exceptionpublic Map<org.apache.kafka.common.TopicPartition,Long> read() throws IOException
IOException - if any file operation fails with an IO exceptionIllegalArgumentException - if the offset checkpoint version is unknownpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void delete()
throws IOException
IOException - if there is any IO exception during deleteCopyright © 2026 Confluent, Inc.. All rights reserved.