Package name.pachler.nio.file.impl
Class PathImpl
java.lang.Object
name.pachler.nio.file.Path
name.pachler.nio.file.impl.PathImpl
- All Implemented Interfaces:
Watchable
This is a minimal implementation of JDK7's Path class,
so all we offer here is what is required for WatchService
and friends to work
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getFile()
This method does not exist in JDK7 and is only supplied for convenienceint
hashCode()
register
(WatchService watcher, WatchEvent.Kind<?>... events) Registers the file system path (a directory) with the given WatchService and provides a WatchKey as a handle for that registration.register
(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) Registers the file system path (a directory) with the givenWatchService
and provides a WatchKey as a handle for that registration.toString()
-
Constructor Details
-
PathImpl
This constructor does not comply with JDK7.- Parameters:
filere
-
-
-
Method Details
-
resolve
-
register
Description copied from interface:Watchable
Registers the file system path (a directory) with the given WatchService and provides a WatchKey as a handle for that registration. Equivalent to callingregister(watcher, events, new WatchEvent.Modifier[0]);
- Specified by:
register
in interfaceWatchable
- Specified by:
register
in classPath
- Throws:
IOException
- See Also:
-
register
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException Description copied from interface:Watchable
Registers the file system path (a directory) with the givenWatchService
and provides a WatchKey as a handle for that registration. The events and modifier lists determine the events that theWatchService
will report.
If a path instance is passed in that represents the same file system object that has been specified in a previous call to this method with the sameWatchService
, the sameWatchKey
will be returned. In this case, theWatchKey
's watch settings are altered to match the new event and modifier lists. Note that such changes may result inStandardWatchEventKind.OVERFLOW
events to be reported on some platforms.
Not all event kinds and modifiers defined inStandardWatchEventKind
,ExtendedWatchEventKind
andExtendedWatchEventModifier
may be supported on a target platform (typically though, in this implementation, all event kinds defined inStandardWatchEventKind
are always supported).- Specified by:
register
in interfaceWatchable
- Specified by:
register
in classPath
- Parameters:
watcher
- a validWatchService
instance.events
- The events to register for. The event kinds defined inStandardWatchEventKind
andExtendedWatchEventKind
define valid event kinds that can be passed in here. Not that not all event kinds may be supported on a given platform, so see the documentation of a specific event kind.modifiers
- The event modifiers to use when registering.invalid reference
WatchEvent$Modifier
WatchService
. Note that some event modifiers may not be supported on a given platform; see the specific modifier for details.- Returns:
- a new
WatchKey
that represents the registration. - Throws:
IOException
- See Also:
-
getFile
This method does not exist in JDK7 and is only supplied for convenience -
toString
-
equals
-
hashCode
public int hashCode()
-