Package name.pachler.nio.file
Class Path
- java.lang.Object
-
- name.pachler.nio.file.Path
-
- All Implemented Interfaces:
Watchable
- Direct Known Subclasses:
PathImpl
public abstract class Path extends java.lang.Object implements Watchable
This class represents an abstract Path object that a WatchService can operate on.
Note that Path is a new way of representing file system paths in JDK7 and is included here to provide source level compatibility. This implementation only uses it as a wrapper for java.io.File. To create a new Path instance, either use the Bootstrapper.newPath() or Paths.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPath()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract booleanequals(java.lang.Object obj)abstract inthashCode()abstract WatchKeyregister(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.abstract WatchKeyregister(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers)Registers the file system path (a directory) with the givenWatchServiceand provides a WatchKey as a handle for that registration.abstract Pathresolve(Path other)abstract java.lang.StringtoString()
-
-
-
Method Detail
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public abstract int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
register
public abstract WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) throws java.io.IOException
Description copied from interface:WatchableRegisters 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]);
-
register
public abstract WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws java.io.IOException
Description copied from interface:WatchableRegisters the file system path (a directory) with the givenWatchServiceand provides a WatchKey as a handle for that registration. The events and modifier lists determine the events that theWatchServicewill 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 sameWatchKeywill 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.OVERFLOWevents to be reported on some platforms.
Not all event kinds and modifiers defined inStandardWatchEventKind,ExtendedWatchEventKindandExtendedWatchEventModifiermay be supported on a target platform (typically though, in this implementation, all event kinds defined inStandardWatchEventKindare always supported).- Specified by:
registerin interfaceWatchable- Parameters:
watcher- a validWatchServiceinstance.events- The events to register for. The event kinds defined inStandardWatchEventKindandExtendedWatchEventKinddefine 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.WatchEvent$Modifiers define special behaviour that's expected from theWatchService. Note that some event modifiers may not be supported on a given platform; see the specific modifier for details.- Returns:
- a new
WatchKeythat represents the registration. - Throws:
java.io.IOException- for general I/O errors- See Also:
StandardWatchEventKind,ExtendedWatchEventKind,ExtendedWatchEventModifier
-
toString
public abstract java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-