Class OpenFile


  • public class OpenFile
    extends AbstractFile
    Action performed when a file is opened.
    • Constructor Detail

      • OpenFile

        public OpenFile​(File file,
                        boolean writeMode,
                        boolean overwrite)
        Creates an open file action.
        Parameters:
        file - the file to be opened.
        writeMode - true if the file is opened in write mode.
        overwrite - true if the file will be overwritten if it exists; false otherwise. This parameter has no effect if writeMode is set to false.
      • OpenFile

        public OpenFile​(File file)
        Creates an open file action in read mode.
        Parameters:
        file - the file to be opened in read mode.
    • Method Detail

      • isOverwritten

        public boolean isOverwritten()
        Tells whether the file will be overwritten if it exists.
        Returns:
        true if the file will be overwritten; false otherwise.
      • isWriteMode

        public boolean isWriteMode()
        Tells whether the file is opened in write mode or not.
        Returns:
        true if the file is opened in write mode; false otherwise.
      • getOverwritingSize

        public long getOverwritingSize()
        Returns the size of the file before overwriting.
        Returns:
        the size of the file before it's overwriting.
      • onStart

        public void onStart()
                     throws SecurityException
        Called when the execution of the action is about to start. This hook is used to check if the action is allowed to be performed.
        Throws:
        SecurityException - if the action is not allowed to be performed.
      • onEnd

        public void onEnd​(boolean endWithSuccess)
        Called when the execution of the action is finished. This hook is used to update the current resources state of the module that performs the action.
        Parameters:
        endWithSuccess - true if the execution of the action was ended with success; false otherwise.