public static FileRawSnapshotWriter create(Path logDir, OffsetAndEpoch snapshotId) {
        Path path = Snapshots.createTempFile(logDir, snapshotId);

        try {
            return new FileRawSnapshotWriter(
                path,
                FileChannel.open(path, StandardOpenOption.WRITE, StandardOpenOption.APPEND),
                snapshotId
            );
        } catch (IOException e) {
            throw new UncheckedIOException(
                String.format(
                    "Error creating snapshot writer. path = %s, snapshotId %s.",
                    path,
                    snapshotId
                ),
                e
            );
        }
    }
Create a snapshot writer for topic partition log dir and snapshot id.

@param logDir the directory for the topic partition
@param snapshotId the end offset and epoch for the snapshotId
raft/src/main/java/org/apache/kafka/snapshot/FileRawSnapshotWriter.java