@SuppressWarnings("unchecked")
    private void load() {
        try (SafeObjectInputStream is = new SafeObjectInputStream(Files.newInputStream(file.toPath()))) {
            Object obj = is.readObject();
            if (!(obj instanceof HashMap)) {
                throw new ConnectException("Expected HashMap but found " + obj.getClass());
            }
            Map<byte[], byte[]> raw = (Map<byte[], byte[]>) obj;
            data = new HashMap<>();
            for (Map.Entry<byte[], byte[]> mapEntry : raw.entrySet()) {
                ByteBuffer key = (mapEntry.getKey() != null) ? ByteBuffer.wrap(mapEntry.getKey()) : null;
                ByteBuffer value = (mapEntry.getValue() != null) ? ByteBuffer.wrap(mapEntry.getValue()) : null;
                data.put(key, value);
            }
        } catch (NoSuchFileException | EOFException e) {
            // NoSuchFileException: Ignore, may be new.
            // EOFException: Ignore, this means the file was missing or corrupt
        } catch (IOException | ClassNotFoundException e) {
            throw new ConnectException(e);
        }
    }
Implementation of OffsetBackingStore that saves data locally to a file. To ensure this behaves
similarly to a real backing store, operations are executed asynchronously on a background thread.
The offset position can be specified
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/utils/InLongFileOffsetBackingStore.java