35 * A file reference that locates a file using a system dependent path. The file |
35 * A file reference that locates a file using a system dependent path. The file |
36 * is not required to exist. |
36 * is not required to exist. |
37 * |
37 * |
38 * <p> On many platforms a <em>path</em> is the means to locate and access files |
38 * <p> On many platforms a <em>path</em> is the means to locate and access files |
39 * in a file system. A path is hierarchical and composed of a sequence of |
39 * in a file system. A path is hierarchical and composed of a sequence of |
40 * directory names separated by a special separator or delimiter. |
40 * directory and file name elements separated by a special separator or |
|
41 * delimiter. |
41 * |
42 * |
42 * <h4>Path operations</h4> |
43 * <h4>Path operations</h4> |
43 * |
44 * |
44 * <p> A system dependent path represented by this class is conceptually a |
45 * <p> A system dependent path represented by this class is conceptually a |
45 * sequence of name elements and optionally a <em>root component</em>. The name |
46 * sequence of name elements and optionally a <em>root component</em>. The name |
157 |
158 |
158 /** |
159 /** |
159 * Returns the root component of this path as a {@code Path} object, |
160 * Returns the root component of this path as a {@code Path} object, |
160 * or {@code null} if this path does not have a root component. |
161 * or {@code null} if this path does not have a root component. |
161 * |
162 * |
162 * @return A path representing the root component of this path, |
163 * @return a path representing the root component of this path, |
163 * or {@code null} |
164 * or {@code null} |
164 */ |
165 */ |
165 public abstract Path getRoot(); |
166 public abstract Path getRoot(); |
166 |
167 |
167 /** |
168 /** |
168 * Returns the name of the file or directory denoted by this path. The |
169 * Returns the name of the file or directory denoted by this path. The |
169 * file name is the <em>farthest</em> element from the root in the directory |
170 * file name is the <em>farthest</em> element from the root in the directory |
170 * hierarchy. |
171 * hierarchy. |
171 * |
172 * |
172 * @return A path representing the name of the file or directory, or |
173 * @return a path representing the name of the file or directory, or |
173 * {@code null} if this path has zero elements |
174 * {@code null} if this path has zero elements |
174 */ |
175 */ |
175 public abstract Path getName(); |
176 public abstract Path getName(); |
176 |
177 |
177 /** |
178 /** |
193 * this method is equivalent to evaluating the expression: |
194 * this method is equivalent to evaluating the expression: |
194 * <blockquote><pre> |
195 * <blockquote><pre> |
195 * subpath(0, getNameCount()-1); |
196 * subpath(0, getNameCount()-1); |
196 * </pre></blockquote> |
197 * </pre></blockquote> |
197 * |
198 * |
198 * @return A path representing the path's parent |
199 * @return a path representing the path's parent |
199 */ |
200 */ |
200 public abstract Path getParent(); |
201 public abstract Path getParent(); |
201 |
202 |
202 /** |
203 /** |
203 * Returns the number of name elements in the path. |
204 * Returns the number of name elements in the path. |
204 * |
205 * |
205 * @return The number of elements in the path, or {@code 0} if this path |
206 * @return the number of elements in the path, or {@code 0} if this path |
206 * only represents a root component |
207 * only represents a root component |
207 */ |
208 */ |
208 public abstract int getNameCount(); |
209 public abstract int getNameCount(); |
209 |
210 |
210 /** |
211 /** |
214 * The element that is <em>closest</em> to the root in the directory hierarchy |
215 * The element that is <em>closest</em> to the root in the directory hierarchy |
215 * has index {@code 0}. The element that is <em>farthest</em> from the root |
216 * has index {@code 0}. The element that is <em>farthest</em> from the root |
216 * has index {@link #getNameCount count}{@code -1}. |
217 * has index {@link #getNameCount count}{@code -1}. |
217 * |
218 * |
218 * @param index |
219 * @param index |
219 * The index of the element |
220 * the index of the element |
220 * |
221 * |
221 * @return The name element |
222 * @return the name element |
222 * |
223 * |
223 * @throws IllegalArgumentException |
224 * @throws IllegalArgumentException |
224 * If {@code index} is negative, {@code index} is greater than or |
225 * if {@code index} is negative, {@code index} is greater than or |
225 * equal to the number of elements, or this path has zero name |
226 * equal to the number of elements, or this path has zero name |
226 * elements. |
227 * elements |
227 */ |
228 */ |
228 public abstract Path getName(int index); |
229 public abstract Path getName(int index); |
229 |
230 |
230 /** |
231 /** |
231 * Returns a relative {@code Path} that is a subsequence of the name |
232 * Returns a relative {@code Path} that is a subsequence of the name |
238 * count}{@code -1}. The returned {@code Path} object has the name elements |
239 * count}{@code -1}. The returned {@code Path} object has the name elements |
239 * that begin at {@code beginIndex} and extend to the element at index {@code |
240 * that begin at {@code beginIndex} and extend to the element at index {@code |
240 * endIndex-1}. |
241 * endIndex-1}. |
241 * |
242 * |
242 * @param beginIndex |
243 * @param beginIndex |
243 * The index of the first element, inclusive |
244 * the index of the first element, inclusive |
244 * @param endIndex |
245 * @param endIndex |
245 * The index of the last element, exclusive |
246 * the index of the last element, exclusive |
246 * |
247 * |
247 * @return A new {@code Path} object that is a subsequence of the name |
248 * @return a new {@code Path} object that is a subsequence of the name |
248 * elements in this {@code Path} |
249 * elements in this {@code Path} |
249 * |
250 * |
250 * @throws IllegalArgumentException |
251 * @throws IllegalArgumentException |
251 * If {@code beginIndex} is negative, or greater than or equal to |
252 * if {@code beginIndex} is negative, or greater than or equal to |
252 * the number of elements. If {@code endIndex} is less than or |
253 * the number of elements. If {@code endIndex} is less than or |
253 * equal to {@code beginIndex}, or larger than the number of elements. |
254 * equal to {@code beginIndex}, or larger than the number of elements. |
254 */ |
255 */ |
255 public abstract Path subpath(int beginIndex, int endIndex); |
256 public abstract Path subpath(int beginIndex, int endIndex); |
256 |
257 |
267 * component of the given path is file system specific. If this path does |
268 * component of the given path is file system specific. If this path does |
268 * not have a root component and the given path has a root component then |
269 * not have a root component and the given path has a root component then |
269 * this path does not start with the given path. |
270 * this path does not start with the given path. |
270 * |
271 * |
271 * @param other |
272 * @param other |
272 * The given path |
273 * the given path |
273 * |
274 * |
274 * @return {@code true} if this path starts with the given path; otherwise |
275 * @return {@code true} if this path starts with the given path; otherwise |
275 * {@code false} |
276 * {@code false} |
276 */ |
277 */ |
277 public abstract boolean startsWith(Path other); |
278 public abstract boolean startsWith(Path other); |
291 * root component of the given path is file system specific. If this path |
292 * root component of the given path is file system specific. If this path |
292 * does not have a root component and the given path has a root component |
293 * does not have a root component and the given path has a root component |
293 * then this path does not end with the given path. |
294 * then this path does not end with the given path. |
294 * |
295 * |
295 * @param other |
296 * @param other |
296 * The given path |
297 * the given path |
297 * |
298 * |
298 * @return {@code true} if this path ends with the given path; otherwise |
299 * @return {@code true} if this path ends with the given path; otherwise |
299 * {@code false} |
300 * {@code false} |
300 */ |
301 */ |
301 public abstract boolean endsWith(Path other); |
302 public abstract boolean endsWith(Path other); |
316 * <p> This method does not access the file system; the path may not locate |
317 * <p> This method does not access the file system; the path may not locate |
317 * a file that exists. Eliminating "{@code ..}" and a preceding name from a |
318 * a file that exists. Eliminating "{@code ..}" and a preceding name from a |
318 * path may result in the path that locates a different file than the original |
319 * path may result in the path that locates a different file than the original |
319 * path. This can arise when the preceding name is a symbolic link. |
320 * path. This can arise when the preceding name is a symbolic link. |
320 * |
321 * |
321 * @return The resulting path, or this path if it does not contain |
322 * @return the resulting path, or this path if it does not contain |
322 * redundant name elements, or {@code null} if this path does not |
323 * redundant name elements, or {@code null} if this path does not |
323 * have a root component and all name elements are redundant. |
324 * have a root component and all name elements are redundant |
324 * |
325 * |
325 * @see #getParent |
326 * @see #getParent |
326 * @see #toRealPath |
327 * @see #toRealPath |
327 */ |
328 */ |
328 public abstract Path normalize(); |
329 public abstract Path normalize(); |
342 * #endsWith ends} with the given path. Where the given path has a root |
343 * #endsWith ends} with the given path. Where the given path has a root |
343 * component then resolution is highly implementation dependent and therefore |
344 * component then resolution is highly implementation dependent and therefore |
344 * unspecified. |
345 * unspecified. |
345 * |
346 * |
346 * @param other |
347 * @param other |
347 * The path to resolve against this path; can be {@code null} |
348 * the path to resolve against this path; can be {@code null} |
348 * |
349 * |
349 * @return The resulting path |
350 * @return the resulting path |
350 * |
351 * |
351 * @see #relativize |
352 * @see #relativize |
352 */ |
353 */ |
353 public abstract Path resolve(Path other); |
354 public abstract Path resolve(Path other); |
354 |
355 |
356 * Converts a given path string to a {@code Path} and resolves it against |
357 * Converts a given path string to a {@code Path} and resolves it against |
357 * this {@code Path} in exactly the manner specified by the {@link |
358 * this {@code Path} in exactly the manner specified by the {@link |
358 * #resolve(Path) resolve} method. |
359 * #resolve(Path) resolve} method. |
359 * |
360 * |
360 * @param other |
361 * @param other |
361 * The path string to resolve against this path |
362 * the path string to resolve against this path |
362 * |
363 * |
363 * @return The resulting path |
364 * @return the resulting path |
364 * |
365 * |
365 * @throws InvalidPathException |
366 * @throws InvalidPathException |
366 * If the path string cannot be converted to a Path. |
367 * If the path string cannot be converted to a Path. |
367 * |
368 * |
368 * @see FileSystem#getPath |
369 * @see FileSystem#getPath |
398 * path is {@code "/a/x"} then the resulting relative path may be {@code |
399 * path is {@code "/a/x"} then the resulting relative path may be {@code |
399 * "../x"}. If {@code "b"} is a symbolic-link then is implementation |
400 * "../x"}. If {@code "b"} is a symbolic-link then is implementation |
400 * dependent if {@code "a/b/../x"} would locate the same file as {@code "/a/x"}. |
401 * dependent if {@code "a/b/../x"} would locate the same file as {@code "/a/x"}. |
401 * |
402 * |
402 * @param other |
403 * @param other |
403 * The resulting path |
404 * the resulting path |
404 * |
405 * |
405 * @return The resulting relative path, or {@code null} if both paths are |
406 * @return the resulting relative path, or {@code null} if both paths are |
406 * equal |
407 * equal |
407 * |
408 * |
408 * @throws IllegalArgumentException |
409 * @throws IllegalArgumentException |
409 * If {@code other} is not a {@code Path} that can be relativized |
410 * if {@code other} is not a {@code Path} that can be relativized |
410 * against this path |
411 * against this path |
411 */ |
412 */ |
412 public abstract Path relativize(Path other); |
413 public abstract Path relativize(Path other); |
413 |
414 |
414 // -- file operations -- |
415 // -- file operations -- |
438 * @param failIfNotExists |
439 * @param failIfNotExists |
439 * {@code true} if the method should fail when the file does not |
440 * {@code true} if the method should fail when the file does not |
440 * exist |
441 * exist |
441 * |
442 * |
442 * @throws NoSuchFileException |
443 * @throws NoSuchFileException |
443 * If the value of the {@code failIfNotExists} is {@code true} and |
444 * if the value of the {@code failIfNotExists} is {@code true} and |
444 * the file does not exist <i>(optional specific exception)</i> |
445 * the file does not exist <i>(optional specific exception)</i> |
445 * @throws DirectoryNotEmptyException |
446 * @throws DirectoryNotEmptyException |
446 * If the file is a directory and could not otherwise be deleted |
447 * if the file is a directory and could not otherwise be deleted |
447 * because the directory is not empty <i>(optional specific |
448 * because the directory is not empty <i>(optional specific |
448 * exception)</i> |
449 * exception)</i> |
449 * @throws IOException |
450 * @throws IOException |
450 * If an I/O error occurs |
451 * if an I/O error occurs |
451 * @throws SecurityException |
452 * @throws SecurityException |
452 * In the case of the default provider, and a security manager is |
453 * In the case of the default provider, and a security manager is |
453 * installed, the {@link SecurityManager#checkDelete(String)} method |
454 * installed, the {@link SecurityManager#checkDelete(String)} method |
454 * is invoked to check delete access to the file |
455 * is invoked to check delete access to the file. |
455 */ |
456 */ |
456 public abstract void delete(boolean failIfNotExists) throws IOException; |
457 public abstract void delete(boolean failIfNotExists) throws IOException; |
457 |
458 |
458 /** |
459 /** |
459 * Creates a symbolic link to a target <i>(optional operation)</i>. |
460 * Creates a symbolic link to a target <i>(optional operation)</i>. |
474 * IOException}. Additionally, some operating systems may require that the |
475 * IOException}. Additionally, some operating systems may require that the |
475 * Java virtual machine be started with implementation specific privileges to |
476 * Java virtual machine be started with implementation specific privileges to |
476 * create symbolic links, in which case this method may throw {@code IOException}. |
477 * create symbolic links, in which case this method may throw {@code IOException}. |
477 * |
478 * |
478 * @param target |
479 * @param target |
479 * The target of the link |
480 * the target of the link |
480 * @param attrs |
481 * @param attrs |
481 * The array of attributes to set atomically when creating the |
482 * the array of attributes to set atomically when creating the |
482 * symbolic link |
483 * symbolic link |
483 * |
484 * |
484 * @return this path |
485 * @return this path |
485 * |
486 * |
486 * @throws UnsupportedOperationException |
487 * @throws UnsupportedOperationException |
487 * If the implementation does not support symbolic links or the |
488 * if the implementation does not support symbolic links or the |
488 * array contains an attribute that cannot be set atomically when |
489 * array contains an attribute that cannot be set atomically when |
489 * creating the symbolic link |
490 * creating the symbolic link |
490 * @throws FileAlreadyExistsException |
491 * @throws FileAlreadyExistsException |
491 * If a file with the name already exists <i>(optional specific |
492 * if a file with the name already exists <i>(optional specific |
492 * exception)</i> |
493 * exception)</i> |
493 * @throws IOException |
494 * @throws IOException |
494 * If an I/O error occurs |
495 * if an I/O error occurs |
495 * @throws SecurityException |
496 * @throws SecurityException |
496 * In the case of the the default provider, and a security manager |
497 * In the case of the the default provider, and a security manager |
497 * is installed, it denies {@link LinkPermission}<tt>("symbolic")</tt> |
498 * is installed, it denies {@link LinkPermission}<tt>("symbolic")</tt> |
498 * or its {@link SecurityManager#checkWrite(String) checkWrite} |
499 * or its {@link SecurityManager#checkWrite(String) checkWrite} |
499 * method denies write access to the path of the symbolic link. |
500 * method denies write access to the path of the symbolic link. |
515 * same file system. Furthermore, on some platforms, the Java virtual machine |
516 * same file system. Furthermore, on some platforms, the Java virtual machine |
516 * may require to be started with implementation specific privileges to |
517 * may require to be started with implementation specific privileges to |
517 * create hard links or to create links to directories. |
518 * create hard links or to create links to directories. |
518 * |
519 * |
519 * @param existing |
520 * @param existing |
520 * A reference to an existing file |
521 * a reference to an existing file |
521 * |
522 * |
522 * @return this path |
523 * @return this path |
523 * |
524 * |
524 * @throws UnsupportedOperationException |
525 * @throws UnsupportedOperationException |
525 * If the implementation does not support adding an existing file |
526 * if the implementation does not support adding an existing file |
526 * to a directory |
527 * to a directory |
527 * @throws FileAlreadyExistsException |
528 * @throws FileAlreadyExistsException |
528 * If the entry could not otherwise be created because a file of |
529 * if the entry could not otherwise be created because a file of |
529 * that name already exists <i>(optional specific exception)</i> |
530 * that name already exists <i>(optional specific exception)</i> |
530 * @throws IOException |
531 * @throws IOException |
531 * If an I/O error occurs |
532 * if an I/O error occurs |
532 * @throws SecurityException |
533 * @throws SecurityException |
533 * In the case of the the default provider, and a security manager |
534 * In the case of the the default provider, and a security manager |
534 * is installed, it denies {@link LinkPermission}<tt>("hard")</tt> |
535 * is installed, it denies {@link LinkPermission}<tt>("hard")</tt> |
535 * or its {@link SecurityManager#checkWrite(String) checkWrite} |
536 * or its {@link SecurityManager#checkWrite(String) checkWrite} |
536 * method denies write access to both this path and the path of the |
537 * method denies write access to both this path and the path of the |
537 * existing file |
538 * existing file. |
538 * |
539 * |
539 * @see BasicFileAttributes#linkCount |
540 * @see BasicFileAttributes#linkCount |
540 */ |
541 */ |
541 public abstract Path createLink(Path existing) throws IOException; |
542 public abstract Path createLink(Path existing) throws IOException; |
542 |
543 |
547 * links</a> then this method is used read the target of the link, failing |
548 * links</a> then this method is used read the target of the link, failing |
548 * if the file is not a link. The target of the link need not exist. The |
549 * if the file is not a link. The target of the link need not exist. The |
549 * returned {@code Path} object will be associated with the same file |
550 * returned {@code Path} object will be associated with the same file |
550 * system as this {@code Path}. |
551 * system as this {@code Path}. |
551 * |
552 * |
552 * @return A {@code Path} object representing the target of the link |
553 * @return a {@code Path} object representing the target of the link |
553 * |
554 * |
554 * @throws UnsupportedOperationException |
555 * @throws UnsupportedOperationException |
555 * If the implementation does not support symbolic links |
556 * if the implementation does not support symbolic links |
556 * @throws NotLinkException |
557 * @throws NotLinkException |
557 * If the target could otherwise not be read because the file |
558 * if the target could otherwise not be read because the file |
558 * is not a link <i>(optional specific exception)</i> |
559 * is not a link <i>(optional specific exception)</i> |
559 * @throws IOException |
560 * @throws IOException |
560 * If an I/O error occurs |
561 * if an I/O error occurs |
561 * @throws SecurityException |
562 * @throws SecurityException |
562 * In the case of the the default provider, and a security manager |
563 * In the case of the the default provider, and a security manager |
563 * is installed, it checks that {@code FilePermission} has been |
564 * is installed, it checks that {@code FilePermission} has been |
564 * granted with the "{@code readlink}" action to read the link. |
565 * granted with the "{@code readlink}" action to read the link. |
565 */ |
566 */ |
603 * URI represents the given path in the file system or it represents a |
604 * URI represents the given path in the file system or it represents a |
604 * <em>compound</em> URI that encodes the URI of the enclosing file system. |
605 * <em>compound</em> URI that encodes the URI of the enclosing file system. |
605 * A format for compound URIs is not defined in this release; such a scheme |
606 * A format for compound URIs is not defined in this release; such a scheme |
606 * may be added in a future release. |
607 * may be added in a future release. |
607 * |
608 * |
608 * @return An absolute, hierarchical URI with a non-empty path component |
609 * @return an absolute, hierarchical URI with a non-empty path component |
609 * |
610 * |
610 * @throws IOError |
611 * @throws IOError |
611 * If an I/O error occurs obtaining the absolute path, or where a |
612 * if an I/O error occurs obtaining the absolute path, or where a |
612 * file system is constructed to access the contents of a file as |
613 * file system is constructed to access the contents of a file as |
613 * a file system, the URI of the enclosing file system cannot be |
614 * a file system, and the URI of the enclosing file system cannot be |
614 * obtained. |
615 * obtained |
615 * |
616 * |
616 * @throws SecurityException |
617 * @throws SecurityException |
617 * In the case of the the default provider, and a security manager |
618 * In the case of the the default provider, and a security manager |
618 * is installed, the {@link #toAbsolutePath toAbsolutePath} method |
619 * is installed, the {@link #toAbsolutePath toAbsolutePath} method |
619 * throws a security exception. |
620 * throws a security exception. |
628 * method simply returns this path. Otherwise, this method resolves the path |
629 * method simply returns this path. Otherwise, this method resolves the path |
629 * in an implementation dependent manner, typically by resolving the path |
630 * in an implementation dependent manner, typically by resolving the path |
630 * against a file system default directory. Depending on the implementation, |
631 * against a file system default directory. Depending on the implementation, |
631 * this method may throw an I/O error if the file system is not accessible. |
632 * this method may throw an I/O error if the file system is not accessible. |
632 * |
633 * |
633 * @return A {@code Path} object representing the absolute path |
634 * @return a {@code Path} object representing the absolute path |
634 * |
635 * |
635 * @throws IOError |
636 * @throws IOError |
636 * If an I/O error occurs |
637 * if an I/O error occurs |
637 * @throws SecurityException |
638 * @throws SecurityException |
638 * In the case of the the default provider, and a security manager |
639 * In the case of the the default provider, and a security manager |
639 * is installed, its {@link SecurityManager#checkPropertyAccess(String) |
640 * is installed, its {@link SecurityManager#checkPropertyAccess(String) |
640 * checkPropertyAccess} method is invoked to check access to the |
641 * checkPropertyAccess} method is invoked to check access to the |
641 * system property {@code user.dir} |
642 * system property {@code user.dir} |
668 * non-"{@code ..}" name then an implementation will typically causes both |
669 * non-"{@code ..}" name then an implementation will typically causes both |
669 * names to be removed. When not resolving symbolic links and the preceding |
670 * names to be removed. When not resolving symbolic links and the preceding |
670 * name is a symbolic link then the names are only removed if it guaranteed |
671 * name is a symbolic link then the names are only removed if it guaranteed |
671 * that the resulting path will locate the same file as this path. |
672 * that the resulting path will locate the same file as this path. |
672 * |
673 * |
673 * @return An absolute path represent the <em>real</em> path of the file |
674 * @return an absolute path represent the <em>real</em> path of the file |
674 * located by this object |
675 * located by this object |
675 * |
676 * |
676 * @throws IOException |
677 * @throws IOException |
677 * If the file does not exist or an I/O error occurs |
678 * if the file does not exist or an I/O error occurs |
678 * @throws SecurityException |
679 * @throws SecurityException |
679 * In the case of the the default provider, and a security manager |
680 * In the case of the the default provider, and a security manager |
680 * is installed, its {@link SecurityManager#checkRead(String) checkRead} |
681 * is installed, its {@link SecurityManager#checkRead(String) checkRead} |
681 * method is invoked to check read access to the file, and where |
682 * method is invoked to check read access to the file, and where |
682 * this path is not absolute, its {@link SecurityManager#checkPropertyAccess(String) |
683 * this path is not absolute, its {@link SecurityManager#checkPropertyAccess(String) |
741 * then the target file is replaced. The check for the existence of the file |
742 * then the target file is replaced. The check for the existence of the file |
742 * and the creation of the new file may not be atomic with respect to other |
743 * and the creation of the new file may not be atomic with respect to other |
743 * file system activities. |
744 * file system activities. |
744 * |
745 * |
745 * @param target |
746 * @param target |
746 * The target location |
747 * the target location |
747 * @param options |
748 * @param options |
748 * Options specifying how the copy should be done |
749 * options specifying how the copy should be done |
749 * |
750 * |
750 * @return The target |
751 * @return the target |
751 * |
752 * |
752 * @throws UnsupportedOperationException |
753 * @throws UnsupportedOperationException |
753 * If the array contains a copy option that is not supported |
754 * if the array contains a copy option that is not supported |
754 * @throws FileAlreadyExistsException |
755 * @throws FileAlreadyExistsException |
755 * The target file exists and cannot be replaced because the |
756 * if the target file exists and cannot be replaced because the |
756 * {@code REPLACE_EXISTING} option is not specified, or the target |
757 * {@code REPLACE_EXISTING} option is not specified, or the target |
757 * file is a non-empty directory <i>(optional specific exception)</i> |
758 * file is a non-empty directory <i>(optional specific exception)</i> |
758 * @throws IOException |
759 * @throws IOException |
759 * If an I/O error occurs |
760 * if an I/O error occurs |
760 * @throws SecurityException |
761 * @throws SecurityException |
761 * In the case of the default provider, and a security manager is |
762 * In the case of the default provider, and a security manager is |
762 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
763 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
763 * method is invoked to check read access to the source file, the |
764 * method is invoked to check read access to the source file, the |
764 * {@link SecurityManager#checkWrite(String) checkWrite} is invoked |
765 * {@link SecurityManager#checkWrite(String) checkWrite} is invoked |
827 * original file and the target file may both exist, the target file may be |
828 * original file and the target file may both exist, the target file may be |
828 * incomplete or some of its file attributes may not been copied from the |
829 * incomplete or some of its file attributes may not been copied from the |
829 * original file. |
830 * original file. |
830 * |
831 * |
831 * @param target |
832 * @param target |
832 * The target location |
833 * the target location |
833 * @param options |
834 * @param options |
834 * Options specifying how the move should be done |
835 * options specifying how the move should be done |
835 * |
836 * |
836 * @return The target |
837 * @return the target |
837 * |
838 * |
838 * @throws UnsupportedOperationException |
839 * @throws UnsupportedOperationException |
839 * If the array contains a copy option that is not supported |
840 * if the array contains a copy option that is not supported |
840 * @throws FileAlreadyExistsException |
841 * @throws FileAlreadyExistsException |
841 * The target file exists and cannot be replaced because the |
842 * if the target file exists and cannot be replaced because the |
842 * {@code REPLACE_EXISTING} option is not specified, or the target |
843 * {@code REPLACE_EXISTING} option is not specified, or the target |
843 * file is a non-empty directory |
844 * file is a non-empty directory |
844 * @throws AtomicMoveNotSupportedException |
845 * @throws AtomicMoveNotSupportedException |
845 * The options array contains the {@code ATOMIC_MOVE} option but |
846 * if the options array contains the {@code ATOMIC_MOVE} option but |
846 * the file cannot be moved as an atomic file system operation. |
847 * the file cannot be moved as an atomic file system operation. |
847 * @throws IOException |
848 * @throws IOException |
848 * If an I/O error occurs |
849 * if an I/O error occurs |
849 * @throws SecurityException |
850 * @throws SecurityException |
850 * In the case of the default provider, and a security manager is |
851 * In the case of the default provider, and a security manager is |
851 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
852 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
852 * method is invoked to check write access to both the source and |
853 * method is invoked to check write access to both the source and |
853 * target file. |
854 * target file. |
873 * |
874 * |
874 * <p> When an implementation supports operations on entries in the |
875 * <p> When an implementation supports operations on entries in the |
875 * directory that execute in a race-free manner then the returned directory |
876 * directory that execute in a race-free manner then the returned directory |
876 * stream is a {@link SecureDirectoryStream}. |
877 * stream is a {@link SecureDirectoryStream}. |
877 * |
878 * |
878 * @return A new and open {@code DirectoryStream} object |
879 * @return a new and open {@code DirectoryStream} object |
879 * |
880 * |
880 * @throws NotDirectoryException |
881 * @throws NotDirectoryException |
881 * If the file could not otherwise be opened because it is not |
882 * if the file could not otherwise be opened because it is not |
882 * a directory <i>(optional specific exception)</i> |
883 * a directory <i>(optional specific exception)</i> |
883 * @throws IOException |
884 * @throws IOException |
884 * If an I/O error occurs |
885 * if an I/O error occurs |
885 * @throws SecurityException |
886 * @throws SecurityException |
886 * In the case of the default provider, and a security manager is |
887 * In the case of the default provider, and a security manager is |
887 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
888 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
888 * method is invoked to check read access to the directory. |
889 * method is invoked to check read access to the directory. |
889 */ |
890 */ |
918 * <p> When an implementation supports operations on entries in the |
919 * <p> When an implementation supports operations on entries in the |
919 * directory that execute in a race-free manner then the returned directory |
920 * directory that execute in a race-free manner then the returned directory |
920 * stream is a {@link SecureDirectoryStream}. |
921 * stream is a {@link SecureDirectoryStream}. |
921 * |
922 * |
922 * @param glob |
923 * @param glob |
923 * The glob pattern |
924 * the glob pattern |
924 * |
925 * |
925 * @return A new and open {@code DirectoryStream} object |
926 * @return a new and open {@code DirectoryStream} object |
926 * |
927 * |
927 * @throws java.util.regex.PatternSyntaxException |
928 * @throws java.util.regex.PatternSyntaxException |
928 * If the pattern is invalid |
929 * if the pattern is invalid |
929 * @throws UnsupportedOperationException |
930 * @throws UnsupportedOperationException |
930 * If the pattern syntax is not known to the implementation |
931 * if the pattern syntax is not known to the implementation |
931 * @throws NotDirectoryException |
932 * @throws NotDirectoryException |
932 * If the file could not otherwise be opened because it is not |
933 * if the file could not otherwise be opened because it is not |
933 * a directory <i>(optional specific exception)</i> |
934 * a directory <i>(optional specific exception)</i> |
934 * @throws IOException |
935 * @throws IOException |
935 * If an I/O error occurs |
936 * if an I/O error occurs |
936 * @throws SecurityException |
937 * @throws SecurityException |
937 * In the case of the default provider, and a security manager is |
938 * In the case of the default provider, and a security manager is |
938 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
939 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
939 * method is invoked to check read access to the directory. |
940 * method is invoked to check read access to the directory. |
940 */ |
941 */ |
984 * }; |
985 * }; |
985 * Path dir = ... |
986 * Path dir = ... |
986 * DirectoryStream<Path> stream = dir.newDirectoryStream(filter); |
987 * DirectoryStream<Path> stream = dir.newDirectoryStream(filter); |
987 * </pre> |
988 * </pre> |
988 * @param filter |
989 * @param filter |
989 * The directory stream filter |
990 * the directory stream filter |
990 * |
991 * |
991 * @return A new and open {@code DirectoryStream} object |
992 * @return a new and open {@code DirectoryStream} object |
992 * |
993 * |
993 * @throws NotDirectoryException |
994 * @throws NotDirectoryException |
994 * If the file could not otherwise be opened because it is not |
995 * if the file could not otherwise be opened because it is not |
995 * a directory <i>(optional specific exception)</i> |
996 * a directory <i>(optional specific exception)</i> |
996 * @throws IOException |
997 * @throws IOException |
997 * If an I/O error occurs |
998 * if an I/O error occurs |
998 * @throws SecurityException |
999 * @throws SecurityException |
999 * In the case of the default provider, and a security manager is |
1000 * In the case of the default provider, and a security manager is |
1000 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1001 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1001 * method is invoked to check read access to the directory. |
1002 * method is invoked to check read access to the directory. |
1002 */ |
1003 */ |
1016 * is identified by its {@link FileAttribute#name name}. If more than one |
1017 * is identified by its {@link FileAttribute#name name}. If more than one |
1017 * attribute of the same name is included in the array then all but the last |
1018 * attribute of the same name is included in the array then all but the last |
1018 * occurrence is ignored. |
1019 * occurrence is ignored. |
1019 * |
1020 * |
1020 * @param attrs |
1021 * @param attrs |
1021 * An optional list of file attributes to set atomically when |
1022 * an optional list of file attributes to set atomically when |
1022 * creating the file |
1023 * creating the file |
1023 * |
1024 * |
1024 * @return This path |
1025 * @return this path |
1025 * |
1026 * |
1026 * @throws UnsupportedOperationException |
1027 * @throws UnsupportedOperationException |
1027 * If the array contains an attribute that cannot be set atomically |
1028 * if the array contains an attribute that cannot be set atomically |
1028 * when creating the file |
1029 * when creating the file |
1029 * @throws FileAlreadyExistsException |
1030 * @throws FileAlreadyExistsException |
1030 * If a file of that name already exists |
1031 * if a file of that name already exists |
1031 * <i>(optional specific exception)</i> |
1032 * <i>(optional specific exception)</i> |
1032 * @throws IOException |
1033 * @throws IOException |
1033 * If an I/O error occurs |
1034 * if an I/O error occurs |
1034 * @throws SecurityException |
1035 * @throws SecurityException |
1035 * In the case of the default provider, and a security manager is |
1036 * In the case of the default provider, and a security manager is |
1036 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1037 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1037 * method is invoked to check write access to the new file. |
1038 * method is invoked to check write access to the new file. |
1038 */ |
1039 */ |
1051 * file attribute is identified by its {@link FileAttribute#name name}. If |
1052 * file attribute is identified by its {@link FileAttribute#name name}. If |
1052 * more than one attribute of the same name is included in the array then all |
1053 * more than one attribute of the same name is included in the array then all |
1053 * but the last occurrence is ignored. |
1054 * but the last occurrence is ignored. |
1054 * |
1055 * |
1055 * @param attrs |
1056 * @param attrs |
1056 * An optional list of file attributes to set atomically when |
1057 * an optional list of file attributes to set atomically when |
1057 * creating the directory |
1058 * creating the directory |
1058 * |
1059 * |
1059 * @return This path |
1060 * @return this path |
1060 * |
1061 * |
1061 * @throws UnsupportedOperationException |
1062 * @throws UnsupportedOperationException |
1062 * If the array contains an attribute that cannot be set atomically |
1063 * if the array contains an attribute that cannot be set atomically |
1063 * when creating the directory |
1064 * when creating the directory |
1064 * @throws FileAlreadyExistsException |
1065 * @throws FileAlreadyExistsException |
1065 * If a directory could not otherwise be created because a file of |
1066 * if a directory could not otherwise be created because a file of |
1066 * that name already exists <i>(optional specific exception)</i> |
1067 * that name already exists <i>(optional specific exception)</i> |
1067 * @throws IOException |
1068 * @throws IOException |
1068 * If an I/O error occurs |
1069 * if an I/O error occurs |
1069 * @throws SecurityException |
1070 * @throws SecurityException |
1070 * In the case of the default provider, and a security manager is |
1071 * In the case of the default provider, and a security manager is |
1071 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1072 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1072 * method is invoked to check write access to the new directory. |
1073 * method is invoked to check write access to the new directory. |
1073 */ |
1074 */ |
1183 * creating the file |
1184 * creating the file |
1184 * |
1185 * |
1185 * @return a new seekable byte channel |
1186 * @return a new seekable byte channel |
1186 * |
1187 * |
1187 * @throws IllegalArgumentException |
1188 * @throws IllegalArgumentException |
1188 * If the set contains an invalid combination of options |
1189 * if the set contains an invalid combination of options |
1189 * @throws UnsupportedOperationException |
1190 * @throws UnsupportedOperationException |
1190 * If an unsupported open option is specified or the array contains |
1191 * if an unsupported open option is specified or the array contains |
1191 * attributes that cannot be set atomically when creating the file |
1192 * attributes that cannot be set atomically when creating the file |
1192 * @throws FileAlreadyExistsException |
1193 * @throws FileAlreadyExistsException |
1193 * If a file of that name already exists and the {@link |
1194 * if a file of that name already exists and the {@link |
1194 * StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified |
1195 * StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified |
1195 * <i>(optional specific exception)</i> |
1196 * <i>(optional specific exception)</i> |
1196 * @throws IOException |
1197 * @throws IOException |
1197 * If an I/O error occurs |
1198 * if an I/O error occurs |
1198 * @throws SecurityException |
1199 * @throws SecurityException |
1199 * In the case of the default provider, and a security manager is |
1200 * In the case of the default provider, and a security manager is |
1200 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1201 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1201 * method is invoked to check read access to the path if the file is |
1202 * method is invoked to check read access to the path if the file is |
1202 * opened for reading. The {@link SecurityManager#checkWrite(String) |
1203 * opened for reading. The {@link SecurityManager#checkWrite(String) |
1217 * except that the options are specified by an array. In the case of the |
1218 * except that the options are specified by an array. In the case of the |
1218 * default provider, the returned seekable byte channel is a {@link |
1219 * default provider, the returned seekable byte channel is a {@link |
1219 * FileChannel}. |
1220 * FileChannel}. |
1220 * |
1221 * |
1221 * @param options |
1222 * @param options |
1222 * Options specifying how the file is opened |
1223 * options specifying how the file is opened |
1223 * |
1224 * |
1224 * @return a new seekable byte channel |
1225 * @return a new seekable byte channel |
1225 * |
1226 * |
1226 * @throws IllegalArgumentException |
1227 * @throws IllegalArgumentException |
1227 * If the set contains an invalid combination of options |
1228 * if the set contains an invalid combination of options |
1228 * @throws UnsupportedOperationException |
1229 * @throws UnsupportedOperationException |
1229 * If an unsupported open option is specified |
1230 * if an unsupported open option is specified |
1230 * @throws FileAlreadyExistsException |
1231 * @throws FileAlreadyExistsException |
1231 * If a file of that name already exists and the {@link |
1232 * if a file of that name already exists and the {@link |
1232 * StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified |
1233 * StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified |
1233 * <i>(optional specific exception)</i> |
1234 * <i>(optional specific exception)</i> |
1234 * @throws IOException {@inheritDoc} |
1235 * @throws IOException {@inheritDoc} |
1235 * @throws SecurityException {@inheritDoc} |
1236 * @throws SecurityException {@inheritDoc} |
1236 */ |
1237 */ |
1243 * stream to read bytes from the file. The stream will not be buffered, and |
1244 * stream to read bytes from the file. The stream will not be buffered, and |
1244 * is not required to support the {@link InputStream#mark mark} or {@link |
1245 * is not required to support the {@link InputStream#mark mark} or {@link |
1245 * InputStream#reset reset} methods. The stream will be safe for access by |
1246 * InputStream#reset reset} methods. The stream will be safe for access by |
1246 * multiple concurrent threads. Reading commences at the beginning of the file. |
1247 * multiple concurrent threads. Reading commences at the beginning of the file. |
1247 * |
1248 * |
1248 * @return An input stream to read bytes from the file |
1249 * @return an input stream to read bytes from the file |
1249 * |
1250 * |
1250 * @throws IOException |
1251 * @throws IOException |
1251 * If an I/O error occurs |
1252 * if an I/O error occurs |
1252 * @throws SecurityException |
1253 * @throws SecurityException |
1253 * In the case of the default provider, and a security manager is |
1254 * In the case of the default provider, and a security manager is |
1254 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1255 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1255 * method is invoked to check read access to the file. |
1256 * method is invoked to check read access to the file. |
1256 */ |
1257 */ |
1277 * Path logfile = ... |
1278 * Path logfile = ... |
1278 * OutputStream out = new BufferedOutputStream(logfile.newOutputStream(CREATE, APPEND)); |
1279 * OutputStream out = new BufferedOutputStream(logfile.newOutputStream(CREATE, APPEND)); |
1279 * </pre> |
1280 * </pre> |
1280 * |
1281 * |
1281 * @param options |
1282 * @param options |
1282 * Options specifying how the file is opened |
1283 * options specifying how the file is opened |
1283 * |
1284 * |
1284 * @return a new seekable byte channel |
1285 * @return a new seekable byte channel |
1285 * |
1286 * |
1286 * @throws IllegalArgumentException |
1287 * @throws IllegalArgumentException |
1287 * If {@code options} contains an invalid combination of options |
1288 * if {@code options} contains an invalid combination of options |
1288 * @throws UnsupportedOperationException |
1289 * @throws UnsupportedOperationException |
1289 * If an unsupported open option is specified |
1290 * if an unsupported open option is specified |
1290 * @throws IOException |
1291 * @throws IOException |
1291 * If an I/O error occurs |
1292 * if an I/O error occurs |
1292 * @throws SecurityException |
1293 * @throws SecurityException |
1293 * In the case of the default provider, and a security manager is |
1294 * In the case of the default provider, and a security manager is |
1294 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1295 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1295 * method is invoked to check write access to the file. |
1296 * method is invoked to check write access to the file. |
1296 */ |
1297 */ |
1310 * |
1311 * |
1311 * <p> The resulting stream will not be buffered. The stream will be safe |
1312 * <p> The resulting stream will not be buffered. The stream will be safe |
1312 * for access by multiple concurrent threads. |
1313 * for access by multiple concurrent threads. |
1313 * |
1314 * |
1314 * @param options |
1315 * @param options |
1315 * Options specifying how the file is opened |
1316 * options specifying how the file is opened |
1316 * @param attrs |
1317 * @param attrs |
1317 * An optional list of file attributes to set atomically when |
1318 * an optional list of file attributes to set atomically when |
1318 * creating the file |
1319 * creating the file |
1319 * |
1320 * |
1320 * @return A new output stream |
1321 * @return a new output stream |
1321 * |
1322 * |
1322 * @throws IllegalArgumentException |
1323 * @throws IllegalArgumentException |
1323 * If the set contains an invalid combination of options |
1324 * if the set contains an invalid combination of options |
1324 * @throws UnsupportedOperationException |
1325 * @throws UnsupportedOperationException |
1325 * If an unsupported open option is specified or the array contains |
1326 * if an unsupported open option is specified or the array contains |
1326 * attributes that cannot be set atomically when creating the file |
1327 * attributes that cannot be set atomically when creating the file |
1327 * @throws IOException |
1328 * @throws IOException |
1328 * If an I/O error occurs |
1329 * if an I/O error occurs |
1329 * @throws SecurityException |
1330 * @throws SecurityException |
1330 * In the case of the default provider, and a security manager is |
1331 * In the case of the default provider, and a security manager is |
1331 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1332 * installed, the {@link SecurityManager#checkWrite(String) checkWrite} |
1332 * method is invoked to check write access to the file. |
1333 * method is invoked to check write access to the file. |
1333 */ |
1334 */ |
1347 * the file system to determine if the file is considered hidden. |
1348 * the file system to determine if the file is considered hidden. |
1348 * |
1349 * |
1349 * @return {@code true} if the file is considered hidden |
1350 * @return {@code true} if the file is considered hidden |
1350 * |
1351 * |
1351 * @throws IOException |
1352 * @throws IOException |
1352 * If an I/O error occurs |
1353 * if an I/O error occurs |
1353 * @throws SecurityException |
1354 * @throws SecurityException |
1354 * In the case of the default provider, and a security manager is |
1355 * In the case of the default provider, and a security manager is |
1355 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1356 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1356 * method is invoked to check read access to the file. |
1357 * method is invoked to check read access to the file. |
1357 */ |
1358 */ |
1446 * <p> Where a file is registered with a watch service by means of a symbolic |
1447 * <p> Where a file is registered with a watch service by means of a symbolic |
1447 * link then it is implementation specific if the watch continues to depend |
1448 * link then it is implementation specific if the watch continues to depend |
1448 * on the existence of the link after it is registered. |
1449 * on the existence of the link after it is registered. |
1449 * |
1450 * |
1450 * @param watcher |
1451 * @param watcher |
1451 * The watch service to which this object is to be registered |
1452 * the watch service to which this object is to be registered |
1452 * @param events |
1453 * @param events |
1453 * The events for which this object should be registered |
1454 * the events for which this object should be registered |
1454 * @param modifiers |
1455 * @param modifiers |
1455 * The modifiers, if any, that modify how the object is registered |
1456 * the modifiers, if any, that modify how the object is registered |
1456 * |
1457 * |
1457 * @return A key representing the registration of this object with the |
1458 * @return a key representing the registration of this object with the |
1458 * given watch service |
1459 * given watch service |
1459 * |
1460 * |
1460 * @throws UnsupportedOperationException |
1461 * @throws UnsupportedOperationException |
1461 * If unsupported events or modifiers are specified |
1462 * if unsupported events or modifiers are specified |
1462 * @throws IllegalArgumentException |
1463 * @throws IllegalArgumentException |
1463 * If an invalid combination of events or modifiers is specified |
1464 * if an invalid combination of events or modifiers is specified |
1464 * @throws ClosedWatchServiceException |
1465 * @throws ClosedWatchServiceException |
1465 * If the watch service is closed |
1466 * if the watch service is closed |
1466 * @throws NotDirectoryException |
1467 * @throws NotDirectoryException |
1467 * If the file is registered to watch the entries in a directory |
1468 * if the file is registered to watch the entries in a directory |
1468 * and the file is not a directory <i>(optional specific exception)</i> |
1469 * and the file is not a directory <i>(optional specific exception)</i> |
1469 * @throws IOException |
1470 * @throws IOException |
1470 * If an I/O error occurs |
1471 * if an I/O error occurs |
1471 * @throws SecurityException |
1472 * @throws SecurityException |
1472 * In the case of the default provider, and a security manager is |
1473 * In the case of the default provider, and a security manager is |
1473 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1474 * installed, the {@link SecurityManager#checkRead(String) checkRead} |
1474 * method is invoked to check read access to the file. |
1475 * method is invoked to check read access to the file. |
1475 */ |
1476 */ |
1535 * element that is closest to the root in the directory hierarchy, the |
1536 * element that is closest to the root in the directory hierarchy, the |
1536 * second element is the next closest, and so on. The last element returned |
1537 * second element is the next closest, and so on. The last element returned |
1537 * is the name of the file or directory denoted by this path. The {@link |
1538 * is the name of the file or directory denoted by this path. The {@link |
1538 * #getRoot root} component, if present, is not returned by the iterator. |
1539 * #getRoot root} component, if present, is not returned by the iterator. |
1539 * |
1540 * |
1540 * @return An iterator over the name elements of this path. |
1541 * @return an iterator over the name elements of this path. |
1541 */ |
1542 */ |
1542 @Override |
1543 @Override |
1543 public abstract Iterator<Path> iterator(); |
1544 public abstract Iterator<Path> iterator(); |
1544 |
1545 |
1545 // -- compareTo/equals/hashCode -- |
1546 // -- compareTo/equals/hashCode -- |
1548 * Compares two abstract paths lexicographically. The ordering defined by |
1549 * Compares two abstract paths lexicographically. The ordering defined by |
1549 * this method is provider specific, and in the case of the default |
1550 * this method is provider specific, and in the case of the default |
1550 * provider, platform specific. This method does not access the file system |
1551 * provider, platform specific. This method does not access the file system |
1551 * and neither file is required to exist. |
1552 * and neither file is required to exist. |
1552 * |
1553 * |
1553 * @param other The path compared to this path. |
1554 * @param other the path compared to this path. |
1554 * |
1555 * |
1555 * @return Zero if the argument is {@link #equals equal} to this path, a |
1556 * @return zero if the argument is {@link #equals equal} to this path, a |
1556 * value less than zero if this path is lexicographically less than |
1557 * value less than zero if this path is lexicographically less than |
1557 * the argument, or a value greater than zero if this path is |
1558 * the argument, or a value greater than zero if this path is |
1558 * lexicographically greater than the argument |
1559 * lexicographically greater than the argument |
1559 */ |
1560 */ |
1560 @Override |
1561 @Override |
1572 * file system and the file is not required to exist. |
1573 * file system and the file is not required to exist. |
1573 * |
1574 * |
1574 * <p> This method satisfies the general contract of the {@link |
1575 * <p> This method satisfies the general contract of the {@link |
1575 * java.lang.Object#equals(Object) Object.equals} method. </p> |
1576 * java.lang.Object#equals(Object) Object.equals} method. </p> |
1576 * |
1577 * |
1577 * @param ob |
1578 * @param other |
1578 * The object to which this object is to be compared |
1579 * the object to which this object is to be compared |
1579 * |
1580 * |
1580 * @return {@code true} if, and only if, the given object is a {@code Path} |
1581 * @return {@code true} if, and only if, the given object is a {@code Path} |
1581 * that is identical to this {@code Path} |
1582 * that is identical to this {@code Path} |
1582 */ |
1583 */ |
1583 @Override |
1584 @Override |
1584 public abstract boolean equals(Object ob); |
1585 public abstract boolean equals(Object other); |
1585 |
1586 |
1586 /** |
1587 /** |
1587 * Computes a hash code for this path. |
1588 * Computes a hash code for this path. |
1588 * |
1589 * |
1589 * <p> The hash code is based upon the components of the path, and |
1590 * <p> The hash code is based upon the components of the path, and |
1590 * satisfies the general contract of the {@link Object#hashCode |
1591 * satisfies the general contract of the {@link Object#hashCode |
1591 * Object.hashCode} method. |
1592 * Object.hashCode} method. |
1592 * |
1593 * |
1593 * @return The hash-code value for this Path |
1594 * @return the hash-code value for this path |
1594 */ |
1595 */ |
1595 @Override |
1596 @Override |
1596 public abstract int hashCode(); |
1597 public abstract int hashCode(); |
1597 |
1598 |
1598 /** |
1599 /** |
1603 * by this method may differ from the original String used to create the path. |
1604 * by this method may differ from the original String used to create the path. |
1604 * |
1605 * |
1605 * <p> The returned path string uses the default name {@link |
1606 * <p> The returned path string uses the default name {@link |
1606 * FileSystem#getSeparator separator} to separate names in the path. |
1607 * FileSystem#getSeparator separator} to separate names in the path. |
1607 * |
1608 * |
1608 * @return The string representation of this path |
1609 * @return the string representation of this path |
1609 */ |
1610 */ |
1610 @Override |
1611 @Override |
1611 public abstract String toString(); |
1612 public abstract String toString(); |
1612 } |
1613 } |