default Offset readOffsetPosition(int offsetVersion, DataInputDeserializer in)
            throws IOException {
        switch (offsetVersion) {
            case 1:
                OffsetFactory offsetFactory = getOffsetFactory();
                return in.readBoolean()
                        ? offsetFactory.newOffset(in.readUTF(), in.readLong())
                        : null;
            case 2:
            case 3:
                return readOffsetPosition(in);
            default:
                throw new IOException("Unknown version: " + offsetVersion);
        }
    }
read {@link Offset} from input stream and write {@link Offset} to output stream.
Copy from com.ververica:flink-cdc-base:2.3.0.
inlong-sort/sort-flink/cdc-base/src/main/java/org/apache/inlong/sort/cdc/base/source/meta/offset/OffsetDeserializerSerializer.java