APIdia Launch Partner
Top Description Fields Constructors Methods
sun.nio.fs

public abstract Class UnixFileSystemProvider

extends AbstractFileSystemProvider
Class Inheritance
Known Direct Subclasses
sun.nio.fs.LinuxFileSystemProvider
Imports
java.io.IOException, .FilePermission, java.net.URI, java.nio.channels.AsynchronousFileChannel, .FileChannel, .SeekableByteChannel, java.nio.file.AccessMode, .CopyOption, .DirectoryNotEmptyException, .DirectoryStream, .FileAlreadyExistsException, .FileStore, .FileSystem, .FileSystemAlreadyExistsException, .LinkOption, .NotDirectoryException, .NotLinkException, .OpenOption, .Path, java.nio.file.attribute.BasicFileAttributes, .BasicFileAttributeView, .FileAttribute, .FileAttributeView, .FileOwnerAttributeView, .PosixFileAttributes, .PosixFileAttributeView, java.nio.file.spi.FileTypeDetector, java.util.Map, .HashSet, .Set, java.util.concurrent.ExecutorService, jdk.internal.util.StaticProperty, sun.nio.ch.ThreadPool

Base implementation of FileSystemProvider

Field Summary

Modifier and TypeField and Description
private static final byte[]
private final UnixFileSystem

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv final FileTypeDetector
chain(final AbstractFileTypeDetector... detectors)

Returns a FileTypeDetector that chains the given array of file type detectors.

public void
checkAccess(Path obj, AccessMode... modes)

Implements abstract java.nio.file.spi.FileSystemProvider.checkAccess.

Checks the existence, and optionally the accessibility, of a file.

private void
public void
copy(Path source, Path target, CopyOption... options)

Implements abstract java.nio.file.spi.FileSystemProvider.copy.

Copy a file to a target file.

public void
createDirectory(Path obj, FileAttribute<?>... attrs)

Implements abstract java.nio.file.spi.FileSystemProvider.createDirectory.

Creates a new directory.

public boolean
exists(Path path, LinkOption... options)

Overrides java.nio.file.spi.FileSystemProvider.exists.

Tests whether a file exists.

public <V extends FileAttributeView> V
getFileAttributeView(Path obj, Class<V> type, LinkOption... options)

Implements abstract java.nio.file.spi.FileSystemProvider.getFileAttributeView.

Returns a file attribute view of a given type.

protected DynamicFileAttributeView
getFileAttributeView(Path obj, String name, LinkOption... options)

Implements abstract sun.nio.fs.AbstractFileSystemProvider.getFileAttributeView.

Gets a DynamicFileAttributeView by name.

pack-priv abstract FileStore
getFileStore(UnixPath path)

Returns a FileStore to represent the file system where the given file reside.

public FileStore
getFileStore(Path obj)

Implements abstract java.nio.file.spi.FileSystemProvider.getFileStore.

Returns the FileStore representing the file store where a file is located.

public final FileSystem
getFileSystem(URI uri)

Implements abstract java.nio.file.spi.FileSystemProvider.getFileSystem.

Returns an existing FileSystem created by this provider.

pack-priv FileTypeDetector
getFileTypeDetector()

Returns a FileTypeDetector for this platform.

public Path
getPath(URI uri)

Implements abstract java.nio.file.spi.FileSystemProvider.getPath.

Return a Path object by converting the given URI.

public final String
getScheme()

Implements abstract java.nio.file.spi.FileSystemProvider.getScheme.

Returns the URI scheme that identifies this provider.

public byte[]
getSunPathForSocketFile(Path obj)

Implements abstract sun.nio.fs.AbstractFileSystemProvider.getSunPathForSocketFile.

Returns a path name as bytes for a Unix domain socket.

pack-priv boolean
implDelete(Path obj, boolean failIfNotExists)

Implements abstract sun.nio.fs.AbstractFileSystemProvider.implDelete.

Deletes a file.

public boolean
isExecutable(Path path)

Overrides sun.nio.fs.AbstractFileSystemProvider.isExecutable.

Tests whether a file is executable.

public boolean
isHidden(Path obj)

Implements abstract java.nio.file.spi.FileSystemProvider.isHidden.

Tells whether or not a file is considered hidden.

public boolean
isReadable(Path path)

Overrides sun.nio.fs.AbstractFileSystemProvider.isReadable.

Tests whether a file is readable.

public boolean
isSameFile(Path obj1, Path obj2)

Implements abstract java.nio.file.spi.FileSystemProvider.isSameFile.

Tests if two paths locate the same file.

public boolean
isWritable(Path path)

Overrides sun.nio.fs.AbstractFileSystemProvider.isWritable.

Tests whether a file is writable.

private UnixFileKey
public void
move(Path source, Path target, CopyOption... options)

Implements abstract java.nio.file.spi.FileSystemProvider.move.

Move or rename a file to a target file.

public AsynchronousFileChannel
newAsynchronousFileChannel(Path obj, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs)

Overrides java.nio.file.spi.FileSystemProvider.newAsynchronousFileChannel.

Opens or creates a file for reading and/or writing, returning an asynchronous file channel to access the file.

public SeekableByteChannel
newByteChannel(Path obj, Set<? extends OpenOption> options, FileAttribute<?>... attrs)

Implements abstract java.nio.file.spi.FileSystemProvider.newByteChannel.

Opens or creates a file, returning a seekable byte channel to access the file.

public DirectoryStream<Path>
newDirectoryStream(Path obj, DirectoryStream.Filter<? super Path> filter)

Implements abstract java.nio.file.spi.FileSystemProvider.newDirectoryStream.

Opens a directory, returning a DirectoryStream to iterate over the entries in the directory.

public FileChannel
newFileChannel(Path obj, Set<? extends OpenOption> options, FileAttribute<?>... attrs)

Overrides java.nio.file.spi.FileSystemProvider.newFileChannel.

Opens or creates a file for reading and/or writing, returning a file channel to access the file.

pack-priv abstract UnixFileSystem
newFileSystem(String dir)

Constructs a new file system using the given default directory.

public final FileSystem
newFileSystem(URI uri, Map<String, ?> env)

Implements abstract java.nio.file.spi.FileSystemProvider.newFileSystem.

Constructs a new FileSystem object identified by a URI.

public <A extends BasicFileAttributes> A
readAttributes(Path file, Class<A> type, LinkOption... options)

Implements abstract java.nio.file.spi.FileSystemProvider.readAttributes.

Reads a file's attributes as a bulk operation.

public <A extends BasicFileAttributes> A
readAttributesIfExists(Path path, Class<A> type, LinkOption... options)

Overrides java.nio.file.spi.FileSystemProvider.readAttributesIfExists.

Reads a file's attributes as a bulk operation if it exists.

pack-priv UnixFileSystem
Inherited from sun.nio.fs.AbstractFileSystemProvider:
deletedeleteIfExistsreadAttributessetAttribute

Field Detail

EMPTY_PATHback to summary
private static final byte[] EMPTY_PATH
theFileSystemback to summary
private final UnixFileSystem theFileSystem

Constructor Detail

UnixFileSystemProviderback to summary
public UnixFileSystemProvider()
Annotations
@SuppressWarnings:this-escape

Method Detail

chainback to summary
pack-priv final FileTypeDetector chain(final AbstractFileTypeDetector... detectors)

Returns a FileTypeDetector that chains the given array of file type detectors. When the implProbeContentType method is invoked then each of the detectors is invoked in turn, the result from the first to detect the file type is returned.

checkAccessback to summary
public void checkAccess(Path obj, AccessMode... modes) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.checkAccess.

Doc from java.nio.file.spi.FileSystemProvider.checkAccess.

Checks the existence, and optionally the accessibility, of a file.

This method may be used by the isReadable, isWritable and isExecutable methods to check the accessibility of a file.

This method checks the existence of a file and that this Java virtual machine has appropriate privileges that would allow it access the file according to all of access modes specified in the modes parameter as follows:

Access Modes
Value Description
READ Checks that the file exists and that the Java virtual machine has permission to read the file.
WRITE Checks that the file exists and that the Java virtual machine has permission to write to the file,
EXECUTE Checks that the file exists and that the Java virtual machine has permission to execute the file. The semantics may differ when checking access to a directory. For example, on UNIX systems, checking for EXECUTE access checks that the Java virtual machine has permission to search the directory in order to access file or subdirectories.

If the modes parameter is of length zero, then the existence of the file is checked.

This method follows symbolic links if the file referenced by this object is a symbolic link. Depending on the implementation, this method may require to read file permissions, access control lists, or other file attributes in order to check the effective access to the file. To determine the effective access to a file may require access to several attributes and so in some implementations this method may not be atomic with respect to other file system operations.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
checkUriback to summary
private void checkUri(URI uri)
copyback to summary
public void copy(Path source, Path target, CopyOption... options) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.copy.

Doc from java.nio.file.spi.FileSystemProvider.copy.

Copy a file to a target file. This method works in exactly the manner specified by the Files#copy(Path, Path, CopyOption[]) method except that both the source and target paths must be associated with this provider.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
createDirectoryback to summary
public void createDirectory(Path obj, FileAttribute<?>... attrs) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.createDirectory.

Doc from java.nio.file.spi.FileSystemProvider.createDirectory.

Creates a new directory. This method works in exactly the manner specified by the Files#createDirectory method.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs or the parent directory does not exist
existsback to summary
public boolean exists(Path path, LinkOption... options)

Overrides java.nio.file.spi.FileSystemProvider.exists.

Doc from java.nio.file.spi.FileSystemProvider.exists.

Tests whether a file exists. This method works in exactly the manner specified by the Files#exists(Path, LinkOption...) method.

Annotations
@Override
getFileAttributeViewback to summary
public <V extends FileAttributeView> V getFileAttributeView(Path obj, Class<V> type, LinkOption... options)

Implements abstract java.nio.file.spi.FileSystemProvider.getFileAttributeView.

Doc from java.nio.file.spi.FileSystemProvider.getFileAttributeView.

Returns a file attribute view of a given type. This method works in exactly the manner specified by the Files#getFileAttributeView method.

Annotations
@Override
@SuppressWarnings:unchecked
getFileAttributeViewback to summary
protected DynamicFileAttributeView getFileAttributeView(Path obj, String name, LinkOption... options)

Implements abstract sun.nio.fs.AbstractFileSystemProvider.getFileAttributeView.

Doc from sun.nio.fs.AbstractFileSystemProvider.getFileAttributeView.

Gets a DynamicFileAttributeView by name. Returns null if the view is not available.

Annotations
@Override
getFileStoreback to summary
pack-priv abstract FileStore getFileStore(UnixPath path) throws IOException

Returns a FileStore to represent the file system where the given file reside.

getFileStoreback to summary
public FileStore getFileStore(Path obj) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.getFileStore.

Doc from java.nio.file.spi.FileSystemProvider.getFileStore.

Returns the FileStore representing the file store where a file is located. This method works in exactly the manner specified by the Files#getFileStore method.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getFileSystemback to summary
public final FileSystem getFileSystem(URI uri)

Implements abstract java.nio.file.spi.FileSystemProvider.getFileSystem.

Doc from java.nio.file.spi.FileSystemProvider.getFileSystem.

Returns an existing FileSystem created by this provider.

This method returns a reference to a FileSystem that was created by invoking the newFileSystem(URI,Map) method. File systems created by the newFileSystem(Path,Map) method are not returned by this method. The file system is identified by its URI. Its exact form is highly provider dependent. In the case of the default provider the URI's path component is "/" and the authority, query and fragment components are undefined (Undefined components are represented by null).

Once a file system created by this provider is closed it is provider-dependent if this method returns a reference to the closed file system or throws FileSystemNotFoundException. If the provider allows a new file system to be created with the same URI as a file system it previously created then this method throws the exception if invoked after the file system is closed (and before a new instance is created by the newFileSystem method).

Annotations
@Override
getFileTypeDetectorback to summary
pack-priv FileTypeDetector getFileTypeDetector()

Returns a FileTypeDetector for this platform.

getPathback to summary
public Path getPath(URI uri)

Implements abstract java.nio.file.spi.FileSystemProvider.getPath.

Doc from java.nio.file.spi.FileSystemProvider.getPath.

Return a Path object by converting the given URI. The resulting Path is associated with a FileSystem that already exists or is constructed automatically.

The exact form of the URI is file system provider dependent. In the case of the default provider, the URI scheme is "file" and the given URI has a non-empty path component, and undefined query, and fragment components. The resulting Path is associated with the default default FileSystem.

Annotations
@Override
getSchemeback to summary
public final String getScheme()

Implements abstract java.nio.file.spi.FileSystemProvider.getScheme.

Doc from java.nio.file.spi.FileSystemProvider.getScheme.

Returns the URI scheme that identifies this provider.

Annotations
@Override
getSunPathForSocketFileback to summary
public byte[] getSunPathForSocketFile(Path obj)

Implements abstract sun.nio.fs.AbstractFileSystemProvider.getSunPathForSocketFile.

Doc from sun.nio.fs.AbstractFileSystemProvider.getSunPathForSocketFile.

Returns a path name as bytes for a Unix domain socket. Different encodings may be used for these names on some platforms. If path is empty, then an empty byte[] is returned.

Annotations
@Override
implDeleteback to summary
pack-priv boolean implDelete(Path obj, boolean failIfNotExists) throws IOException

Implements abstract sun.nio.fs.AbstractFileSystemProvider.implDelete.

Doc from sun.nio.fs.AbstractFileSystemProvider.implDelete.

Deletes a file. The failIfNotExists parameters determines if an IOException is thrown when the file does not exist.

Annotations
@Override
isExecutableback to summary
public boolean isExecutable(Path path)

Overrides sun.nio.fs.AbstractFileSystemProvider.isExecutable.

Doc from sun.nio.fs.AbstractFileSystemProvider.isExecutable.

Tests whether a file is executable.

Annotations
@Override
isHiddenback to summary
public boolean isHidden(Path obj)

Implements abstract java.nio.file.spi.FileSystemProvider.isHidden.

Doc from java.nio.file.spi.FileSystemProvider.isHidden.

Tells whether or not a file is considered hidden. This method works in exactly the manner specified by the Files#isHidden method.

This method is invoked by the isHidden method.

Annotations
@Override
isReadableback to summary
public boolean isReadable(Path path)

Overrides sun.nio.fs.AbstractFileSystemProvider.isReadable.

Doc from sun.nio.fs.AbstractFileSystemProvider.isReadable.

Tests whether a file is readable.

Annotations
@Override
isSameFileback to summary
public boolean isSameFile(Path obj1, Path obj2) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.isSameFile.

Doc from java.nio.file.spi.FileSystemProvider.isSameFile.

Tests if two paths locate the same file. This method works in exactly the manner specified by the Files#isSameFile method.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
isWritableback to summary
public boolean isWritable(Path path)

Overrides sun.nio.fs.AbstractFileSystemProvider.isWritable.

Doc from sun.nio.fs.AbstractFileSystemProvider.isWritable.

Tests whether a file is writable.

Annotations
@Override
lastFileKeyback to summary
private UnixFileKey lastFileKey(UnixPath path) throws UnixException
moveback to summary
public void move(Path source, Path target, CopyOption... options) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.move.

Doc from java.nio.file.spi.FileSystemProvider.move.

Move or rename a file to a target file. This method works in exactly the manner specified by the Files#move method except that both the source and target paths must be associated with this provider.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
newAsynchronousFileChannelback to summary
public AsynchronousFileChannel newAsynchronousFileChannel(Path obj, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException

Overrides java.nio.file.spi.FileSystemProvider.newAsynchronousFileChannel.

Doc from java.nio.file.spi.FileSystemProvider.newAsynchronousFileChannel.

Opens or creates a file for reading and/or writing, returning an asynchronous file channel to access the file. This method works in exactly the manner specified by the AsynchronousFileChannel.open method. A provider that does not support all the features required to construct an asynchronous file channel throws UnsupportedOperationException. The default provider is required to support the creation of asynchronous file channels. When not overridden, the default implementation of this method throws UnsupportedOperationException.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
newByteChannelback to summary
public SeekableByteChannel newByteChannel(Path obj, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.newByteChannel.

Doc from java.nio.file.spi.FileSystemProvider.newByteChannel.

Opens or creates a file, returning a seekable byte channel to access the file. This method works in exactly the manner specified by the Files#newByteChannel(Path, Set, FileAttribute[]) method.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
newDirectoryStreamback to summary
public DirectoryStream<Path> newDirectoryStream(Path obj, DirectoryStream.Filter<? super Path> filter) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.newDirectoryStream.

Doc from java.nio.file.spi.FileSystemProvider.newDirectoryStream.

Opens a directory, returning a DirectoryStream to iterate over the entries in the directory. This method works in exactly the manner specified by the Files#newDirectoryStream(java.nio.file.Path, java.nio.file.DirectoryStream.Filter) method.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
newFileChannelback to summary
public FileChannel newFileChannel(Path obj, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException

Overrides java.nio.file.spi.FileSystemProvider.newFileChannel.

Doc from java.nio.file.spi.FileSystemProvider.newFileChannel.

Opens or creates a file for reading and/or writing, returning a file channel to access the file. This method works in exactly the manner specified by the FileChannel.open method. A provider that does not support all the features required to construct a file channel throws UnsupportedOperationException. The default provider is required to support the creation of file channels. When not overridden, the default implementation throws UnsupportedOperationException.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
newFileSystemback to summary
pack-priv abstract UnixFileSystem newFileSystem(String dir)

Constructs a new file system using the given default directory.

newFileSystemback to summary
public final FileSystem newFileSystem(URI uri, Map<String, ?> env)

Implements abstract java.nio.file.spi.FileSystemProvider.newFileSystem.

Doc from java.nio.file.spi.FileSystemProvider.newFileSystem.

Constructs a new FileSystem object identified by a URI. This method is invoked by the FileSystems#newFileSystem(URI, Map) method to open a new file system identified by a URI.

The uri parameter is an absolute, hierarchical URI, with a scheme equal (without regard to case) to the scheme supported by this provider. The exact form of the URI is highly provider dependent. The env parameter is a map of provider specific properties to configure the file system.

This method throws FileSystemAlreadyExistsException if the file system already exists because it was previously created by an invocation of this method. Once a file system is closed it is provider-dependent if the provider allows a new file system to be created with the same URI as a file system it previously created.

Annotations
@Override
readAttributesback to summary
public <A extends BasicFileAttributes> A readAttributes(Path file, Class<A> type, LinkOption... options) throws IOException

Implements abstract java.nio.file.spi.FileSystemProvider.readAttributes.

Doc from java.nio.file.spi.FileSystemProvider.readAttributes.

Reads a file's attributes as a bulk operation. This method works in exactly the manner specified by the Files#readAttributes(Path, Class, LinkOption[]) method.

Annotations
@Override
@SuppressWarnings:unchecked
Exceptions
IOException:
if an I/O error occurs
readAttributesIfExistsback to summary
public <A extends BasicFileAttributes> A readAttributesIfExists(Path path, Class<A> type, LinkOption... options) throws IOException

Overrides java.nio.file.spi.FileSystemProvider.readAttributesIfExists.

Doc from java.nio.file.spi.FileSystemProvider.readAttributesIfExists.

Reads a file's attributes as a bulk operation if it exists.

The type parameter is the type of the attributes required and this method returns an instance of that type if supported. All implementations support a basic set of file attributes and so invoking this method with a type parameter of BasicFileAttributes.class will not throw UnsupportedOperationException.

The options array may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.

It is implementation specific if all file attributes are read as an atomic operation with respect to other file system operations.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
theFileSystemback to summary
pack-priv UnixFileSystem theFileSystem()