java.nio.file

Interfaces

CopyOption

An object that configures how to copy or move a file.

DirectoryStream

An object to iterate over the entries in a directory.

FileVisitor

A visitor of files.

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.

PathMatcher

An interface that is implemented by objects that perform match operations on paths.

SecureDirectoryStream

A DirectoryStream that defines operations on files that are located relative to an open directory.

Watchable

An object that may be registered with a watch service so that it can be watched for changes and events.

WatchEvent

An event or a repeated event for an object that is registered with a WatchService.

WatchKey

A token representing the registration of a watchable object with a WatchService.

WatchService

A watch service that watches registered objects for changes and events.

Classes

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.

LinkPermission

The Permission class for link creation operations.

Paths

This class consists exclusively of static methods that return a Path by converting a path string or URI.

SimpleFileVisitor

A simple visitor of files with default behavior to visit all files and to re-throw I/O errors.

StandardWatchEventKinds

Defines the standard event kinds.

Exceptions

AccessDeniedException

Checked exception thrown when a file system operation is denied, typically due to a file permission or other access check.

AtomicMoveNotSupportedException

Checked exception thrown when a file cannot be moved as an atomic file system operation.

ClosedDirectoryStreamException

Unchecked exception thrown when an attempt is made to invoke an operation on a directory stream that is closed.

ClosedFileSystemException

Unchecked exception thrown when an attempt is made to invoke an operation on a file and the file system is closed.

ClosedWatchServiceException

Unchecked exception thrown when an attempt is made to invoke an operation on a watch service that 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.

FileSystemAlreadyExistsException

Runtime exception thrown when an attempt is made to create a file system that already exists.

FileSystemException

Thrown when a file system operation fails on one or two files.

FileSystemLoopException

Checked exception thrown when a file system loop, or cycle, is encountered.

FileSystemNotFoundException

Runtime exception thrown when a file system cannot be found.

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.

NotLinkException

Checked exception thrown when a file system operation fails because a file is not a symbolic link.

ProviderMismatchException

Unchecked exception thrown when an attempt is made to invoke a method on an object created by one file system provider with a parameter created by a different file system provider.

ProviderNotFoundException

Runtime exception thrown when a provider of the required type cannot be found.

ReadOnlyFileSystemException

Unchecked exception thrown when an attempt is made to update an object associated with a read-only FileSystem.

Enums

AccessMode

Defines access modes used to test the accessibility of a file.

FileVisitOption

Defines the file tree traversal options.

FileVisitResult

The result type of a FileVisitor.

LinkOption

Defines the options as to how symbolic links are handled.

StandardCopyOption

Defines the standard copy options.

StandardOpenOption

Defines the standard open options.