See: Description
Interface | Description |
---|---|
CopyOption |
An object that configures how to copy or move a file.
|
DirectoryStream<T> |
An object to iterate over the entries in a directory.
|
DirectoryStream.Filter<T> |
An interface that is implemented by objects that decide if a directory
entry should be accepted or filtered.
|
OpenOption |
An object that configures how to open or create a file.
|
Path |
An object that may be used to locate a file in a file system.
|
Class | Description |
---|---|
Files |
This class consists exclusively of static methods that operate on files,
directories, or other types of files.
|
FileStore |
Storage for files.
|
FileSystem |
Provides an interface to a file system and is the factory for objects to
access files and other objects in the file system.
|
FileSystems |
Factory methods for file systems.
|
Paths |
This class consists exclusively of static methods that return a
Path
by converting a path string. |
Enum | Description |
---|---|
LinkOption |
Defines the options as to how symbolic links are handled.
|
StandardCopyOption |
Defines the standard copy options.
|
StandardOpenOption |
Defines the standard open options.
|
Exception | Description |
---|---|
AtomicMoveNotSupportedException |
Checked exception thrown when a file cannot be moved as an atomic file system
operation.
|
ClosedFileSystemException |
Unchecked exception thrown when an attempt is made to invoke an operation on
a file and the file system is closed.
|
DirectoryIteratorException |
Runtime exception thrown if an I/O error is encountered when iterating over
the entries in a directory.
|
DirectoryNotEmptyException |
Checked exception thrown when a file system operation fails because a
directory is not empty.
|
FileAlreadyExistsException |
Checked exception thrown when an attempt is made to create a file or
directory and a file of that name already exists.
|
FileSystemException |
Thrown when a file system operation fails on one or two files.
|
InvalidPathException |
Unchecked exception thrown when path string cannot be converted into a
Path because the path string contains invalid characters, or
the path string is invalid for other file system specific reasons. |
NoSuchFileException |
Checked exception thrown when an attempt is made to access a file that does
not exist.
|
NotDirectoryException |
Checked exception thrown when a file system operation, intended for a
directory, fails because the file is not a directory.
|
ReadOnlyFileSystemException |
Unchecked exception thrown when an attempt is made to update an object
associated with a
read-only FileSystem . |
The java.nio.file package defines classes to access files and file
systems. The API to access file and file system attributes is defined in the
java.nio.file.attribute
package.
The following features of NIO are NOT supported by this subset:
ScatteringByteChannel
s and GatheringByteChannel
s are not supportedFileSystemProvider
s are not supported;
only the default provider is supportedSYNC
and DSYNC
options are used when opening a file
to require that updates to the file are written synchronously to the underlying
storage device. In the case of the default filesystem, and the file resides on
a local storage device, and the seekable
channel is connected to a file that was opened with one of these
options, then an invocation of the write
method is only guaranteed to return when all changes made to the file
by that invocation have been written to the device. These options are useful
for ensuring that critical information is not lost in the event of a system
crash.
null
argument to a constructor
or method of any class or interface in this package will cause a NullPointerException
to be thrown. Additionally,
invoking a method with a collection containing a null
element will
cause a NullPointerException
, unless otherwise specified.
Unless otherwise noted, methods that attempt to access the file system
will throw ClosedFileSystemException
when invoked on
objects associated with a FileSystem
that has been
closed
. Additionally, any methods
that attempt write access to a file system will throw ReadOnlyFileSystemException
when invoked on an object associated
with a FileSystem
that only provides read-only
access.
IOException
be thrown when an I/O
error occurs. In some cases, these methods define specific I/O exceptions
for common cases. These exceptions, noted as optional specific exceptions,
are thrown by the implementation where it can detect the specific error.
Where the specific error cannot be detected then the more general IOException
is thrown.Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. Use of this specification is subject to license terms.