DirectoryMonitor

class DirectoryMonitor(dir: Path, glob: String)

This feature is provided for mount directories. It is usually better to use WatchService.

Monitor the creation of subdirectories. The reporting timing is when a file that matches the conditions exists in the subdirectory. By default, if a file exists in a subdirectory, it will be reported to the listener. サブディレクトリの作成をモニタする。 報告タイミングは、サブディレクトリ内に条件に一致したファイルが存在している場合になる。 デフォルトではサブディレクトリ内にファイルが存在すればリスナーに報告する。

val mon = Monitor("dir".toPath(), "*.ind")
mon.submit {
println(it)
}

Parameters

dir

対象ディレクトリ

glob

the globbing pattern. The syntax is specified by the FileSystem.getPathMatcher method.

Constructors

Link copied to clipboard
fun DirectoryMonitor(dir: Path, glob: String = "*")

Functions

Link copied to clipboard
fun submit(listener: (Path) -> Unit)

ディレクトリの状態を受け取る。報告すべきサブディレクトリが生成されていれば報告する。

Properties

Link copied to clipboard
var cancel: Boolean = false