@SuppressWarnings("java:S2095")
  @Override
  public Iterator<Modification> getModificationIterator() {
    File file = FSFactoryProducer.getFSFactory().getFile(filePath);
    final BufferedReader reader;
    try {
      reader = new BufferedReader(new FileReader(file));
    } catch (FileNotFoundException e) {
      logger.debug(NO_MODIFICATION_MSG, file);

      // return empty iterator
      return new Iterator<Modification>() {
        @Override
        public boolean hasNext() {
          return false;
        }

        @Override
        public Modification next() {
          throw new NoSuchElementException();
        }
      };
    }

    final Modification[] cachedModification = new Modification[1];
    return new Iterator<Modification>() {
      @Override
      public boolean hasNext() {
        try {
          if (cachedModification[0] == null) {
            String line = reader.readLine();
            if (line == null) {
              reader.close();
              return false;
            } else {
              return decodeModificationAndCache(reader, cachedModification, line);
            }
          }
        } catch (IOException e) {
          logger.warn("An error occurred when reading modifications", e);
        }
        return true;
      }

      @Override
      public Modification next() {
        if (cachedModification[0] == null) {
          throw new NoSuchElementException();
        }
        Modification result = cachedModification[0];
        cachedModification[0] = null;
        return result;
      }
    };
  }
Construct a LocalTextModificationAccessor using a file specified by filePath.

@param filePath the path of the file that is used for storing modifications.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/modification/v1/io/LocalTextModificationAccessor.java