Package com.mku.android.fs.file
Class AndroidSharedFileObserver
java.lang.Object
FileObserver
com.mku.android.fs.file.AndroidSharedFileObserver
public class AndroidSharedFileObserver
extends FileObserver
Implementation of a file observer that detects when a share file has been edited
by external apps. Use this to get notified to re-import the file into the drive.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidClear all file observers.static AndroidSharedFileObservercreateFileObserver(File cacheFile, AesFile aesFile, Consumer<AndroidSharedFileObserver> onFileContentsChanged) Create a file observer that will detect if the file contents of a shared salmon file have changedReturns the encrypted salmon file that is associated with the shared filevoidWhen a file event happens.static voidremoveFileObserver(File cacheFile) Remove the shared filed associated with this observer.voidsetAesFile(AesFile aesFile) Set the salmon file associated with the shared file to observer.
-
Method Details
-
createFileObserver
public static AndroidSharedFileObserver createFileObserver(File cacheFile, AesFile aesFile, Consumer<AndroidSharedFileObserver> onFileContentsChanged) Create a file observer that will detect if the file contents of a shared salmon file have changed- Parameters:
cacheFile- The temporary private decrypted cached fileaesFile- The encrypted file that is associated with the shared fileonFileContentsChanged- Action notifier when file contents change- Returns:
- The shared file observer
-
removeFileObserver
Remove the shared filed associated with this observer.- Parameters:
cacheFile- The cache file.
-
clearFileObservers
public static void clearFileObservers()Clear all file observers. Call this to release any observes you no longer need. -
onEvent
When a file event happens.- Parameters:
e- The type of event that happenedpath- The path to the monitored file
-
getAesFile
Returns the encrypted salmon file that is associated with the shared file- Returns:
- The file
-
setAesFile
Set the salmon file associated with the shared file to observer.- Parameters:
aesFile- The file
-