Package com.swoval.files.apple
Interface FileEventMonitor
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface FileEventMonitor extends java.lang.AutoCloseable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Handle all exceptions.FileEventMonitors.Handle
createStream(java.nio.file.Path path, long latency, java.util.concurrent.TimeUnit timeUnit, Flags.Create flags)
Start monitoring a path.void
stopStream(FileEventMonitors.Handle streamHandle)
Stop monitoring a path previously registered withcreateStream(java.nio.file.Path, long, java.util.concurrent.TimeUnit, com.swoval.files.apple.Flags.Create)
.
-
-
-
Method Detail
-
createStream
FileEventMonitors.Handle createStream(java.nio.file.Path path, long latency, java.util.concurrent.TimeUnit timeUnit, Flags.Create flags) throws ClosedFileEventMonitorException
Start monitoring a path. This may be a no-op if a parent of the path has previously been registered.- Parameters:
path
- the path to monitor. The apple file events api only supports recursive monitoring, so if this path is a directory, all of its children will also be monitored.latency
- the minimum latency with which the os will deliver file events. It seems to be limited to roughly O(10ms), so there is little point in setting the value less than that.timeUnit
- the unit in which the latency is specifiedflags
- the flags specified to create the stream- Returns:
- an opaque handle to the native stream object
- Throws:
ClosedFileEventMonitorException
- if theFileEventMonitor
has been closed
-
stopStream
void stopStream(FileEventMonitors.Handle streamHandle) throws ClosedFileEventMonitorException
Stop monitoring a path previously registered withcreateStream(java.nio.file.Path, long, java.util.concurrent.TimeUnit, com.swoval.files.apple.Flags.Create)
.- Parameters:
streamHandle
- the handle returned bycreateStream(java.nio.file.Path, long, java.util.concurrent.TimeUnit, com.swoval.files.apple.Flags.Create)
- Throws:
ClosedFileEventMonitorException
- if theFileEventMonitor
has been closed
-
close
void close()
Handle all exceptions.- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-