BowlerKernel
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.neuronrobotics.bowlerstudio.util.FileChangeWatcher Class Reference
Collaboration diagram for com.neuronrobotics.bowlerstudio.util.FileChangeWatcher:
Collaboration graph
[legend]

Public Member Functions

void addIFileChangeListener (IFileChangeListener l)
 
void removeIFileChangeListener (IFileChangeListener l)
 
void watch ()
 
File getFileToWatch ()
 
void setFileToWatch (File fileToWatch)
 
boolean isRun ()
 
void close ()
 

Static Public Member Functions

static void clearAll ()
 
static void notifyOfDelete (File fileToWatch)
 
static void close (File fileToWatch)
 
static FileChangeWatcher watch (File fileToWatch) throws IOException
 

Private Member Functions

 FileChangeWatcher (File fileToWatch) throws IOException
 
void register (Path dir) throws IOException
 
void registerAll (final Path start) throws IOException
 

Private Attributes

File fileToWatch
 
boolean run = true
 
final WatchService watcher
 
final Map< WatchKey, Path > keys
 
final boolean recursive = false
 
ArrayList< IFileChangeListenerlisteners = new ArrayList<IFileChangeListener>()
 
Thread watcherThread = null
 

Static Private Attributes

static boolean runThread = true
 
static HashMap< String, FileChangeWatcheractiveListener = new HashMap<String, FileChangeWatcher>()
 

Detailed Description

The Class FileChangeWatcher.

Definition at line 48 of file FileChangeWatcher.java.

Constructor & Destructor Documentation

◆ FileChangeWatcher()

com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.FileChangeWatcher ( File  fileToWatch) throws IOException
private

Member Function Documentation

◆ addIFileChangeListener()

void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.addIFileChangeListener ( IFileChangeListener  l)

◆ clearAll()

static void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.clearAll ( )
static

clear the listeners

Definition at line 78 of file FileChangeWatcher.java.

References com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.activeListener.

◆ close() [1/2]

void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.close ( )

◆ close() [2/2]

static void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.close ( File  fileToWatch)
static

◆ getFileToWatch()

File com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.getFileToWatch ( )

Gets the file to watch.

Returns
the file to watch

Definition at line 327 of file FileChangeWatcher.java.

References com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.fileToWatch.

Referenced by com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.watch().

◆ isRun()

boolean com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.isRun ( )

Checks if is run.

Returns
true, if is run

Definition at line 346 of file FileChangeWatcher.java.

References com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.run.

◆ notifyOfDelete()

static void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.notifyOfDelete ( File  fileToWatch)
static

◆ register()

void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.register ( Path  dir) throws IOException
private

Register the given directory with the WatchService.

Parameters
dirthe dir
Exceptions
IOExceptionSignals that an I/O exception has occurred.

Definition at line 221 of file FileChangeWatcher.java.

References com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.keys, and com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.watcher.

◆ registerAll()

void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.registerAll ( final Path  start) throws IOException
private

Register the given directory, and all its sub-directories, with the WatchService.

Parameters
startthe start
Exceptions
IOExceptionSignals that an I/O exception has occurred.

Definition at line 245 of file FileChangeWatcher.java.

Referenced by com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.FileChangeWatcher().

◆ removeIFileChangeListener()

void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.removeIFileChangeListener ( IFileChangeListener  l)

◆ setFileToWatch()

void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.setFileToWatch ( File  fileToWatch)

Sets the file to watch.

Parameters
fileToWatchthe new file to watch

Definition at line 337 of file FileChangeWatcher.java.

References com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.fileToWatch.

Referenced by com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.FileChangeWatcher().

◆ watch() [1/2]

void com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.watch ( )

◆ watch() [2/2]

static FileChangeWatcher com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.watch ( File  fileToWatch) throws IOException
static

Member Data Documentation

◆ activeListener

HashMap<String, FileChangeWatcher> com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.activeListener = new HashMap<String, FileChangeWatcher>()
staticprivate

◆ fileToWatch

File com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.fileToWatch
private

◆ keys

final Map<WatchKey, Path> com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.keys
private

◆ listeners

ArrayList<IFileChangeListener> com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.listeners = new ArrayList<IFileChangeListener>()
private

◆ recursive

final boolean com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.recursive = false
private

◆ run

boolean com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.run = true
private

◆ runThread

boolean com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.runThread = true
staticprivate

Definition at line 67 of file FileChangeWatcher.java.

◆ watcher

final WatchService com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.watcher
private

◆ watcherThread

Thread com.neuronrobotics.bowlerstudio.util.FileChangeWatcher.watcherThread = null
private

The documentation for this class was generated from the following file: