Package com.microej.kf.util.control.fs
Class OpenFile
- java.lang.Object
-
- com.microej.kf.util.control.fs.AbstractFile
-
- com.microej.kf.util.control.fs.OpenFile
-
public class OpenFile extends AbstractFile
Action performed when a file is opened.
-
-
Field Summary
-
Fields inherited from class com.microej.kf.util.control.fs.AbstractFile
file
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetOverwritingSize()Returns the size of the file before overwriting.booleanisOverwritten()Tells whether the file will be overwritten if it exists.booleanisWriteMode()Tells whether the file is opened in write mode or not.voidonEnd(boolean endWithSuccess)Called when the execution of the action is finished.voidonStart()Called when the execution of the action is about to start.-
Methods inherited from class com.microej.kf.util.control.fs.AbstractFile
getFile
-
-
-
-
Constructor Detail
-
OpenFile
public OpenFile(java.io.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 ifwriteModeis set to false.
-
OpenFile
public OpenFile(java.io.File file)
Creates an open file action in read mode.- Parameters:
file- the file to be opened in read mode.
-
OpenFile
public OpenFile(java.io.RandomAccessFile file)
-
-
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 java.lang.SecurityExceptionCalled 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:
java.lang.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.
-
-