< prev index next >

src/java.base/share/classes/java/nio/file/package-info.java

Print this page




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /**
  27  * Defines interfaces and classes for the Java virtual machine to access files,
  28  * file attributes, and file systems.
  29  *
  30  * <p> The java.nio.file package defines classes to access files and file
  31  * systems. The API to access file and file system attributes is defined in the
  32  * {@link java.nio.file.attribute} package. The {@link java.nio.file.spi}
  33  * package is used by service provider implementors wishing to extend the
  34  * platform default provider, or to construct other provider implementations. </p>
  35  *
  36  * <h3><a name="links">Symbolic Links</a></h3>
  37  * <p> Many operating systems and file systems support for <em>symbolic links</em>.
  38  * A symbolic link is a special file that serves as a reference to another file.
  39  * For the most part, symbolic links are transparent to applications and
  40  * operations on symbolic links are automatically redirected to the <em>target</em>
  41  * of the link. Exceptions to this are when a symbolic link is deleted or
  42  * renamed/moved in which case the link is deleted or removed rather than the
  43  * target of the link. This package includes support for symbolic links where
  44  * implementations provide these semantics. File systems may support other types
  45  * that are semantically close but support for these other types of links is
  46  * not included in this package. </p>
  47  *
  48  * <h3><a name="interop">Interoperability</a></h3>
  49  * <p> The {@link java.io.File} class defines the {@link java.io.File#toPath
  50  * toPath} method to construct a {@link java.nio.file.Path} by converting
  51  * the abstract path represented by the {@code java.io.File} object. The resulting
  52  * {@code Path} can be used to operate on the same file as the {@code File}
  53  * object. The {@code Path} specification provides further information
  54  * on the <a href="Path.html#interop">interoperability</a> between {@code Path}
  55  * and {@code java.io.File} objects. </p>
  56  *
  57  * <h3>Visibility</h3>
  58  * <p> The view of the files and file system provided by classes in this package are
  59  * guaranteed to be consistent with other views provided by other instances in the
  60  * same Java virtual machine.  The view may or may not, however, be consistent with
  61  * the view of the file system as seen by other concurrently running programs due
  62  * to caching performed by the underlying operating system and delays induced by
  63  * network-filesystem protocols. This is true regardless of the language in which
  64  * these other programs are written, and whether they are running on the same machine
  65  * or on some other machine.  The exact nature of any such inconsistencies are
  66  * system-dependent and are therefore unspecified. </p>
  67  *
  68  * <h3><a name="integrity">Synchronized I/O File Integrity</a></h3>
  69  * <p> The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link
  70  * java.nio.file.StandardOpenOption#DSYNC DSYNC} options are used when opening a file
  71  * to require that updates to the file are written synchronously to the underlying
  72  * storage device. In the case of the default provider, and the file resides on
  73  * a local storage device, and the {@link java.nio.channels.SeekableByteChannel
  74  * seekable} channel is connected to a file that was opened with one of these
  75  * options, then an invocation of the {@link
  76  * java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) write}
  77  * method is only guaranteed to return when all changes made to the file
  78  * by that invocation have been written to the device. These options are useful
  79  * for ensuring that critical information is not lost in the event of a system
  80  * crash. If the file does not reside on a local device then no such guarantee
  81  * is made. Whether this guarantee is possible with other {@link
  82  * java.nio.file.spi.FileSystemProvider provider} implementations is provider
  83  * specific. </p>
  84  *
  85  * <h3>General Exceptions</h3>
  86  * <p> Unless otherwise noted, passing a {@code null} argument to a constructor
  87  * or method of any class or interface in this package will cause a {@link
  88  * java.lang.NullPointerException NullPointerException} to be thrown. Additionally,




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /**
  27  * Defines interfaces and classes for the Java virtual machine to access files,
  28  * file attributes, and file systems.
  29  *
  30  * <p> The java.nio.file package defines classes to access files and file
  31  * systems. The API to access file and file system attributes is defined in the
  32  * {@link java.nio.file.attribute} package. The {@link java.nio.file.spi}
  33  * package is used by service provider implementors wishing to extend the
  34  * platform default provider, or to construct other provider implementations. </p>
  35  *
  36  * <h3><a id="links">Symbolic Links</a></h3>
  37  * <p> Many operating systems and file systems support for <em>symbolic links</em>.
  38  * A symbolic link is a special file that serves as a reference to another file.
  39  * For the most part, symbolic links are transparent to applications and
  40  * operations on symbolic links are automatically redirected to the <em>target</em>
  41  * of the link. Exceptions to this are when a symbolic link is deleted or
  42  * renamed/moved in which case the link is deleted or removed rather than the
  43  * target of the link. This package includes support for symbolic links where
  44  * implementations provide these semantics. File systems may support other types
  45  * that are semantically close but support for these other types of links is
  46  * not included in this package. </p>
  47  *
  48  * <h3><a id="interop">Interoperability</a></h3>
  49  * <p> The {@link java.io.File} class defines the {@link java.io.File#toPath
  50  * toPath} method to construct a {@link java.nio.file.Path} by converting
  51  * the abstract path represented by the {@code java.io.File} object. The resulting
  52  * {@code Path} can be used to operate on the same file as the {@code File}
  53  * object. The {@code Path} specification provides further information
  54  * on the <a href="Path.html#interop">interoperability</a> between {@code Path}
  55  * and {@code java.io.File} objects. </p>
  56  *
  57  * <h3>Visibility</h3>
  58  * <p> The view of the files and file system provided by classes in this package are
  59  * guaranteed to be consistent with other views provided by other instances in the
  60  * same Java virtual machine.  The view may or may not, however, be consistent with
  61  * the view of the file system as seen by other concurrently running programs due
  62  * to caching performed by the underlying operating system and delays induced by
  63  * network-filesystem protocols. This is true regardless of the language in which
  64  * these other programs are written, and whether they are running on the same machine
  65  * or on some other machine.  The exact nature of any such inconsistencies are
  66  * system-dependent and are therefore unspecified. </p>
  67  *
  68  * <h3><a id="integrity">Synchronized I/O File Integrity</a></h3>
  69  * <p> The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link
  70  * java.nio.file.StandardOpenOption#DSYNC DSYNC} options are used when opening a file
  71  * to require that updates to the file are written synchronously to the underlying
  72  * storage device. In the case of the default provider, and the file resides on
  73  * a local storage device, and the {@link java.nio.channels.SeekableByteChannel
  74  * seekable} channel is connected to a file that was opened with one of these
  75  * options, then an invocation of the {@link
  76  * java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) write}
  77  * method is only guaranteed to return when all changes made to the file
  78  * by that invocation have been written to the device. These options are useful
  79  * for ensuring that critical information is not lost in the event of a system
  80  * crash. If the file does not reside on a local device then no such guarantee
  81  * is made. Whether this guarantee is possible with other {@link
  82  * java.nio.file.spi.FileSystemProvider provider} implementations is provider
  83  * specific. </p>
  84  *
  85  * <h3>General Exceptions</h3>
  86  * <p> Unless otherwise noted, passing a {@code null} argument to a constructor
  87  * or method of any class or interface in this package will cause a {@link
  88  * java.lang.NullPointerException NullPointerException} to be thrown. Additionally,


< prev index next >