WatchHandle

final class WatchHandle

Provides opaque handle to watcher.

A handle is obtained via PathMethods.withWatcher().

import java.nio.file.Paths
import java.nio.file.StandardWatchEventKinds.ENTRY_CREATE
import little.io.PathMethods

val dir = Paths.get(".")

// Print message when file is created
val handle = dir.withWatcher(ENTRY_CREATE) { evt =>
 println(s"${evt.context} was created.")
}

Thread.sleep(60 * 1000)

// Close handle when finished
handle.close()
class Object
trait Matchable
class Any

Value members

Concrete methods

def close(): Unit

Closes underlying watcher.

Closes underlying watcher.

def isClosed: Boolean

Tests whether underlying watcher is closed.

Tests whether underlying watcher is closed.