/**@class android.os.FileObserver @extends java.lang.Object Monitors files (using <a href="http://en.wikipedia.org/wiki/Inotify">inotify</a>) to fire an event after files are accessed or changed by by any process on the device (including this one). FileObserver is an abstract class; subclasses must implement the event handler {@link #onEvent(int, String)}. <p>Each FileObserver instance monitors a single file or directory. If a directory is monitored, events will be triggered for all files and subdirectories inside the monitored directory.</p> <p>An event mask is used to specify which changes or actions to report. Event type constants are used to describe the possible changes in the event mask as well as what actually happened in event callbacks.</p> <p class="caution"><b>Warning</b>: If a FileObserver is garbage collected, it will stop sending events. To ensure you keep receiving events, you must keep a reference to the FileObserver instance from some other live object.</p> */ var FileObserver = { /**Event type: Data was read from a file */ ACCESS : "1", /**Event type: Data was written to a file */ MODIFY : "2", /**Event type: Metadata (permissions, owner, timestamp) was changed explicitly */ ATTRIB : "4", /**Event type: Someone had a file or directory open for writing, and closed it */ CLOSE_WRITE : "8", /**Event type: Someone had a file or directory open read-only, and closed it */ CLOSE_NOWRITE : "16", /**Event type: A file or directory was opened */ OPEN : "32", /**Event type: A file or subdirectory was moved from the monitored directory */ MOVED_FROM : "64", /**Event type: A file or subdirectory was moved to the monitored directory */ MOVED_TO : "128", /**Event type: A new file or subdirectory was created under the monitored directory */ CREATE : "256", /**Event type: A file was deleted from the monitored directory */ DELETE : "512", /**Event type: The monitored file or directory was deleted; monitoring effectively stops */ DELETE_SELF : "1024", /**Event type: The monitored file or directory was moved; monitoring continues */ MOVE_SELF : "2048", /**Event mask: All valid event types, combined */ ALL_EVENTS : "4095", /**Start watching for events. The monitored file or directory must exist at this time, or else no events will be reported (even if it appears later). If monitoring is already started, this call has no effect. */ startWatching : function( ) {}, /**Stop watching for events. Some events may be in process, so events may continue to be reported even after this method completes. If monitoring is already stopped, this call has no effect. */ stopWatching : function( ) {}, /**The event handler, which must be implemented by subclasses. <p class="note">This method is invoked on a special FileObserver thread. It runs independently of any threads, so take care to use appropriate synchronization! Consider using {@link android.os.Handler#post(Runnable)} to shift event handling work to the main thread to avoid concurrency problems.</p> <p>Event handlers must not throw exceptions.</p> @param {Number} event The type of event which happened @param {String} path The path, relative to the main monitored file or directory, of the file or directory which triggered the event */ onEvent : function( ) {}, };