Class

com.swoval.files.node

PathWatcher

Related Doc: package node

Permalink

class PathWatcher extends AnyRef

Watches directories for file changes. The api permits recursive watching of directories unlike the java.nio.file.WatchService. Some of the behavior may vary by platform due to fundamental differences in the underlying file event apis. For example, Linux doesn't support recursive directory monitoring via inotify, so it's possible in rare cases to miss file events for newly created files in newly created directories. On OSX, it is difficult to disambiguate file creation and modify events, so the kind of event is best effort, but should not be relied upon to accurately reflect the state of the file.

Annotations
@JSExportTopLevel( "PathWatcher" ) @JSExportAll()
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PathWatcher
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new PathWatcher(underlying: files.PathWatcher[Event])

    Permalink
    Attributes
    protected[com.swoval.files.node]

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addObserver(observer: Observer[Event]): Int

    Permalink

    Add an observer of events.

    Add an observer of events.

    observer

    the Observer to add

    returns

    the handle to the observer.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def close(): Unit

    Permalink

    Shutdown the PathWatcher, freeing any native resources.

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. def register(path: String, maxDepth: Int): JSEither[IOException, Boolean]

    Permalink

    Register a path to monitor for file events.

    Register a path to monitor for file events. The watcher will only watch child subdirectories up to maxDepth. For example, with a directory structure like /foo/bar/baz, if we register the path /foo/ with maxDepth 0, we will be notified for any files that are created, updated or deleted in foo, but not bar. If we increase maxDepth to 1, then the files in /foo/bar are monitored, but not the files in /foo/bar/baz.

    path

    the directory to watch for file events

    maxDepth

    the maximum maxDepth of subdirectories to watch

    returns

    an com.swoval.functional.Either containing the result of the registration or an IOException if registration fails. This method should be idempotent and return true the first time the directory is registered or when the depth is changed. Otherwise it should return false.

  18. def removeObserver(handle: Int): Unit

    Permalink

    Remove an observer that was previously added via PathWatcher.addObserver

    Remove an observer that was previously added via PathWatcher.addObserver

    handle

    the handle returned by PathWatcher.addObserver corresponding to the observer to remove.

  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. def unregister(path: String): Unit

    Permalink

    Stop watching a path.

    Stop watching a path.

    path

    the path to remove from monitoring

  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped