static void writeVersion0(final Map<TopicPartition, Long> offsets, final File file) throws IOException {
        final FileOutputStream fileOutputStream = new FileOutputStream(file);
        try (final BufferedWriter writer = new BufferedWriter(
            new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8))) {
            writeIntLine(writer, 0);
            writeIntLine(writer, offsets.size());

            for (final Map.Entry<TopicPartition, Long> entry : offsets.entrySet()) {
                final TopicPartition tp = entry.getKey();
                final Long offset = entry.getValue();
                writeEntry(writer, tp, offset);
            }

            writer.flush();
            fileOutputStream.getFD().sync();
        }
    }
Write all the offsets following the version 0 format without any verification (eg enforcing offsets >= 0)
streams/src/test/java/org/apache/kafka/streams/state/internals/OffsetCheckpointTest.java