public class FileWatcher extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.nio.file.Path,SourceEntry> |
ruleMap |
private java.util.Map<java.nio.file.Path,StyleSource> |
styleMap |
private java.lang.Thread |
thread |
private java.nio.file.WatchService |
watcher |
Constructor and Description |
---|
FileWatcher()
Constructs a new
FileWatcher . |
Modifier and Type | Method and Description |
---|---|
private void |
processEvents()
Process all events for the key queued to the watcher.
|
private <T extends SourceEntry> |
register(T obj,
java.util.Map<java.nio.file.Path,T> map) |
void |
registerStyleSource(StyleSource style)
Registers a map paint style for local file changes, allowing dynamic reloading.
|
void |
registerValidatorRule(SourceEntry rule)
Registers a validator rule for local file changes, allowing dynamic reloading.
|
void |
start()
Starts the File Watcher thread.
|
private java.nio.file.WatchService watcher
private java.lang.Thread thread
private final java.util.Map<java.nio.file.Path,StyleSource> styleMap
private final java.util.Map<java.nio.file.Path,SourceEntry> ruleMap
public FileWatcher()
FileWatcher
.public final void start()
public void registerStyleSource(StyleSource style) throws java.io.IOException
style
- The style to watchjava.lang.IllegalArgumentException
- if style
is null or if it does not provide a local filejava.lang.IllegalStateException
- if the watcher service failed to startjava.io.IOException
- if an I/O error occurspublic void registerValidatorRule(SourceEntry rule) throws java.io.IOException
rule
- The rule to watchjava.lang.IllegalArgumentException
- if rule
is null or if it does not provide a local filejava.lang.IllegalStateException
- if the watcher service failed to startjava.io.IOException
- if an I/O error occursprivate <T extends SourceEntry> void register(T obj, java.util.Map<java.nio.file.Path,T> map) throws java.io.IOException
java.io.IOException
private void processEvents()