55 * method that can be used to construct a relative path between two paths.
56 * Paths can be {@link #compareTo compared}, and tested against each other using
57 * the {@link #startsWith startsWith} and {@link #endsWith endWith} methods.
58 *
59 * <p> This interface extends {@link Watchable} interface so that a directory
60 * located by a path can be {@link #register registered} with a {@link
61 * WatchService} and entries in the directory watched. </p>
62 *
63 * <p> <b>WARNING:</b> This interface is only intended to be implemented by
64 * those developing custom file system implementations. Methods may be added to
65 * this interface in future releases. </p>
66 *
67 * <a name="interop"><h4>Accessing Files</h4></a>
68 * <p> Paths may be used with the {@link Files} class to operate on files,
69 * directories, and other types of files. For example, suppose we want a {@link
70 * java.io.BufferedReader} to read text from a file "{@code access.log}". The
71 * file is located in a directory "{@code logs}" relative to the current working
72 * directory and is UTF-8 encoded.
73 * <pre>
74 * Path path = FileSystems.getDefault().getPath("logs", "access.log");
75 * BufferReader reader = Files.newBufferedReader(path, StandardCharset.UTF_8);
76 * </pre>
77 *
78 * <a name="interop"><h4>Interoperability</h4></a>
79 * <p> Paths associated with the default {@link
80 * java.nio.file.spi.FileSystemProvider provider} are generally interoperable
81 * with the {@link java.io.File java.io.File} class. Paths created by other
82 * providers are unlikely to be interoperable with the abstract path names
83 * represented by {@code java.io.File}. The {@link java.io.File#toPath toPath}
84 * method may be used to obtain a {@code Path} from the abstract path name
85 * represented by a {@code java.io.File} object. The resulting {@code Path} can
86 * be used to operate on the same file as the {@code java.io.File} object. In
87 * addition, the {@link #toFile toFile} method is useful to construct a {@code
88 * File} from the {@code String} representation of a {@code Path}.
89 *
90 * <h4>Concurrency</h4></a>
91 * <p> Implementations of this interface are immutable and safe for use by
92 * multiple concurrent threads.
93 *
94 * @since 1.7
95 * @see Paths
|
55 * method that can be used to construct a relative path between two paths.
56 * Paths can be {@link #compareTo compared}, and tested against each other using
57 * the {@link #startsWith startsWith} and {@link #endsWith endWith} methods.
58 *
59 * <p> This interface extends {@link Watchable} interface so that a directory
60 * located by a path can be {@link #register registered} with a {@link
61 * WatchService} and entries in the directory watched. </p>
62 *
63 * <p> <b>WARNING:</b> This interface is only intended to be implemented by
64 * those developing custom file system implementations. Methods may be added to
65 * this interface in future releases. </p>
66 *
67 * <a name="interop"><h4>Accessing Files</h4></a>
68 * <p> Paths may be used with the {@link Files} class to operate on files,
69 * directories, and other types of files. For example, suppose we want a {@link
70 * java.io.BufferedReader} to read text from a file "{@code access.log}". The
71 * file is located in a directory "{@code logs}" relative to the current working
72 * directory and is UTF-8 encoded.
73 * <pre>
74 * Path path = FileSystems.getDefault().getPath("logs", "access.log");
75 * BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
76 * </pre>
77 *
78 * <a name="interop"><h4>Interoperability</h4></a>
79 * <p> Paths associated with the default {@link
80 * java.nio.file.spi.FileSystemProvider provider} are generally interoperable
81 * with the {@link java.io.File java.io.File} class. Paths created by other
82 * providers are unlikely to be interoperable with the abstract path names
83 * represented by {@code java.io.File}. The {@link java.io.File#toPath toPath}
84 * method may be used to obtain a {@code Path} from the abstract path name
85 * represented by a {@code java.io.File} object. The resulting {@code Path} can
86 * be used to operate on the same file as the {@code java.io.File} object. In
87 * addition, the {@link #toFile toFile} method is useful to construct a {@code
88 * File} from the {@code String} representation of a {@code Path}.
89 *
90 * <h4>Concurrency</h4></a>
91 * <p> Implementations of this interface are immutable and safe for use by
92 * multiple concurrent threads.
93 *
94 * @since 1.7
95 * @see Paths
|