Class ProtwordsFile.ProtwordsUpdater

java.lang.Object
org.codelibs.fess.dict.protwords.ProtwordsFile.ProtwordsUpdater
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
ProtwordsFile

protected class ProtwordsFile.ProtwordsUpdater extends Object implements Closeable
Updater class for processing protwords items during dictionary updates. This class handles the writing and committing of changes to the dictionary file.
  • Field Details

    • isCommit

      protected boolean isCommit
      Flag indicating if the update should be committed
    • newFile

      protected File newFile
      Temporary file for storing updates
    • writer

      protected Writer writer
      Writer for writing to the temporary file
    • item

      protected ProtwordsItem item
      The item being updated
  • Constructor Details

    • ProtwordsUpdater

      protected ProtwordsUpdater(ProtwordsItem newItem)
      Constructor for ProtwordsUpdater.
      Parameters:
      newItem - the item to be updated
  • Method Details

    • write

      public ProtwordsItem write(ProtwordsItem oldItem)
      Writes a protwords item to the temporary file.
      Parameters:
      oldItem - the item to write
      Returns:
      the written item or null if deleted
    • write

      public void write(String line)
      Writes a string line to the temporary file.
      Parameters:
      line - the line to write
    • commit

      public ProtwordsItem commit()
      Commits the current item to the temporary file.
      Returns:
      the committed item or null if no item to commit
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable