893N/A/*
3909N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
893N/A *
893N/A * This code is free software; you can redistribute it and/or modify it
893N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
893N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
893N/A *
893N/A * This code is distributed in the hope that it will be useful, but WITHOUT
893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
893N/A * version 2 for more details (a copy is included in the LICENSE file that
893N/A * accompanied this code).
893N/A *
893N/A * You should have received a copy of the GNU General Public License version
893N/A * 2 along with this work; if not, write to the Free Software Foundation,
893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
893N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
893N/A */
893N/A
893N/A/**
908N/A * Defines interfaces and classes for the Java virtual machine to access files,
893N/A * file attributes, and file systems.
893N/A *
893N/A * <p> The java.nio.file package defines classes to access files and file
893N/A * systems. The API to access file and file system attributes is defined in the
893N/A * {@link java.nio.file.attribute} package. The {@link java.nio.file.spi}
893N/A * package is used by service provider implementors wishing to extend the
3471N/A * platform default provider, or to construct other provider implementations. </p>
893N/A *
893N/A * <a name="links"><h3>Symbolic Links</h3></a>
893N/A * Many operating systems and file systems support for <em>symbolic links</em>.
893N/A * A symbolic link is a special file that serves as a reference to another file.
893N/A * For the most part, symbolic links are transparent to applications and
893N/A * operations on symbolic links are automatically redirected to the <em>target</em>
893N/A * of the link. Exceptions to this are when a symbolic link is deleted or
893N/A * renamed/moved in which case the link is deleted or removed rather than the
893N/A * target of the link. This package includes support for symbolic links where
893N/A * implementations provide these semantics. File systems may support other types
893N/A * that are semantically close but support for these other types of links is
3471N/A * not included in this package. </p>
893N/A *
893N/A * <a name="interop"><h3>Interoperability</h3></a>
893N/A * The {@link java.io.File} class defines the {@link java.io.File#toPath
893N/A * toPath} method to construct a {@link java.nio.file.Path} by converting
893N/A * the abstract path represented by the {@code java.io.File} object. The resulting
893N/A * {@code Path} can be used to operate on the same file as the {@code File}
893N/A * object. The {@code Path} specification provides further information
893N/A * on the <a href="Path.html#interop">interoperability</a> between {@code Path}
3471N/A * and {@code java.io.File} objects. </p>
893N/A *
893N/A * <h3>Visibility</h3>
893N/A * The view of the files and file system provided by classes in this package are
893N/A * guaranteed to be consistent with other views provided by other instances in the
893N/A * same Java virtual machine. The view may or may not, however, be consistent with
893N/A * the view of the file system as seen by other concurrently running programs due
893N/A * to caching performed by the underlying operating system and delays induced by
893N/A * network-filesystem protocols. This is true regardless of the language in which
893N/A * these other programs are written, and whether they are running on the same machine
893N/A * or on some other machine. The exact nature of any such inconsistencies are
3471N/A * system-dependent and are therefore unspecified. </p>
893N/A *
893N/A * <a name="integrity"><h3>Synchronized I/O File Integrity</h3></a>
893N/A * The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link
893N/A * java.nio.file.StandardOpenOption#DSYNC DSYNC} options are used when opening a file
893N/A * to require that updates to the file are written synchronously to the underlying
893N/A * storage device. In the case of the default provider, and the file resides on
893N/A * a local storage device, and the {@link java.nio.channels.SeekableByteChannel
893N/A * seekable} channel is connected to a file that was opened with one of these
893N/A * options, then an invocation of the {@link
893N/A * java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) write}
893N/A * method is only guaranteed to return when all changes made to the file
893N/A * by that invocation have been written to the device. These options are useful
893N/A * for ensuring that critical information is not lost in the event of a system
893N/A * crash. If the file does not reside on a local device then no such guarantee
893N/A * is made. Whether this guarantee is possible with other {@link
893N/A * java.nio.file.spi.FileSystemProvider provider} implementations is provider
3471N/A * specific. </p>
893N/A *
893N/A * <h3>General Exceptions</h3>
893N/A * Unless otherwise noted, passing a {@code null} argument to a constructor
893N/A * or method of any class or interface in this package will cause a {@link
893N/A * java.lang.NullPointerException NullPointerException} to be thrown. Additionally,
893N/A * invoking a method with a collection containing a {@code null} element will
3471N/A * cause a {@code NullPointerException}, unless otherwise specified. </p>
893N/A *
893N/A * <p> Unless otherwise noted, methods that attempt to access the file system
893N/A * will throw {@link java.nio.file.ClosedFileSystemException} when invoked on
893N/A * objects associated with a {@link java.nio.file.FileSystem} that has been
893N/A * {@link java.nio.file.FileSystem#close closed}. Additionally, any methods
893N/A * that attempt write access to a file system will throw {@link
893N/A * java.nio.file.ReadOnlyFileSystemException} when invoked on an object associated
3471N/A * with a {@link java.nio.file.FileSystem} that only provides read-only
3471N/A * access. </p>
893N/A *
893N/A * <p> Unless otherwise noted, invoking a method of any class or interface in
893N/A * this package created by one {@link java.nio.file.spi.FileSystemProvider
893N/A * provider} with a parameter that is an object created by another provider,
3471N/A * will throw {@link java.nio.file.ProviderMismatchException}. </p>
893N/A *
893N/A * <h3>Optional Specific Exceptions</h3>
893N/A * Most of the methods defined by classes in this package that access the
893N/A * file system specify that {@link java.io.IOException} be thrown when an I/O
893N/A * error occurs. In some cases, these methods define specific I/O exceptions
893N/A * for common cases. These exceptions, noted as <i>optional specific exceptions</i>,
893N/A * are thrown by the implementation where it can detect the specific error.
893N/A * Where the specific error cannot be detected then the more general {@code
893N/A * IOException} is thrown.
893N/A *
893N/A * @since 1.7
893N/A */
893N/Apackage java.nio.file;