class LocalTextModificationAccessor implements ModificationReader, ModificationWriter, AutoCloseable {

  @Override
  public Collection<Modification> read() {
    if (!FSFactoryProducer.getFSFactory().getFile(filePath).exists()) {
      logger.debug("No modification has been written to this file");
      return new ArrayList<>();
    }

    String line;
    List<Modification> modificationList = new ArrayList<>();
    try(BufferedReader reader = FSFactoryProducer.getFSFactory().getBufferedReader(filePath)) {
      while ((line = reader.readLine()) != null) {
        if (line.equals(ABORT_MARK) && !modificationList.isEmpty()) {
          modificationList.remove(modificationList.size() - 1);
        } else {
          modificationList.add(decodeModification(line));
        }
      }
    } catch (IOException e) {
      logger.error("An error occurred when reading modifications, and the remaining modifications "
          + "were ignored.", e);
    }
    return modificationList;
  }

  public  LocalTextModificationAccessor(String filePath);

}