Package com.mku.android.fs.file
Class AndroidSharedFileObserver
- java.lang.Object
-
- FileObserver
-
- com.mku.android.fs.file.AndroidSharedFileObserver
-
public class AndroidSharedFileObserver extends FileObserverImplementation 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclearFileObservers()Clear all file observers.static AndroidSharedFileObservercreateFileObserver(java.io.File cacheFile, AesFile aesFile, Consumer<AndroidSharedFileObserver> onFileContentsChanged)Create a file observer that will detect if the file contents of a shared salmon file have changedAesFilegetAesFile()Returns the encrypted salmon file that is associated with the shared filevoidonEvent(int e, java.lang.String path)When a file event happens.static voidremoveFileObserver(java.io.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 Detail
-
createFileObserver
public static AndroidSharedFileObserver createFileObserver(java.io.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
public static void removeFileObserver(java.io.File cacheFile)
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
public void onEvent(int e, java.lang.String path)When a file event happens.- Parameters:
e- The type of event that happenedpath- The path to the monitored file
-
getAesFile
public AesFile getAesFile()
Returns the encrypted salmon file that is associated with the shared file- Returns:
- The file
-
setAesFile
public void setAesFile(AesFile aesFile)
Set the salmon file associated with the shared file to observer.- Parameters:
aesFile- The file
-
-