c

com.swoval.files

NioPathWatcher

class NioPathWatcher extends PathWatcher[Event] with AutoCloseable

Provides a PathWatcher that is backed by a java.nio.file.WatchService.

Linear Supertypes
PathWatcher[Event], AutoCloseable, Observable[Event], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NioPathWatcher
  2. PathWatcher
  3. AutoCloseable
  4. Observable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new NioPathWatcher(directoryRegistry: DirectoryRegistry, watchService: RegisterableWatchService)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def add(typedPath: TypedPath, events: List[Event]): Unit

    Similar to register, but tracks all of the new files found in the directory.

    Similar to register, but tracks all of the new files found in the directory. It polls the directory until the contents stop changing to ensure that a callback is fired for each path in the newly created directory (up to the maxDepth). The assumption is that once the callback is fired for the path, it is safe to assume that no event for a new file in the directory is missed. Without the polling, it would be possible that a new file was created in the directory before we registered it with the watch service. If this happened, then no callback would be invoked for that file.

    typedPath

    The newly created directory to add

  5. def addObserver(observer: Observer[_ >: Event]): Int

    Add an observer of events.

    Add an observer of events.

    observer

    the observer to add

    returns

    the handle to the observer.

    Definition Classes
    NioPathWatcherObservable
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  8. def close(): Unit

    Catch any exceptions in subclasses.

    Catch any exceptions in subclasses.

    Definition Classes
    NioPathWatcherPathWatcher → AutoCloseable
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. def register(path: Path, maxDepth: Int): Either[IOException, Boolean]

    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.

    Definition Classes
    NioPathWatcherPathWatcher
  19. def removeObserver(handle: Int): Unit

    Remove an observer.

    Remove an observer.

    handle

    the handle that was returned by addObserver

    Definition Classes
    NioPathWatcherObservable
  20. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. def unregister(path: Path): Unit

    Stop watching a path.

    Stop watching a path.

    path

    the path to remove from monitoring

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

Inherited from PathWatcher[Event]

Inherited from AutoCloseable

Inherited from Observable[Event]

Inherited from AnyRef

Inherited from Any

Ungrouped