APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.jrtfs

public final Class JrtFileSystemProvider

extends FileSystemProvider
Class Inheritance
Imports
java.io.*, java.net.MalformedURLException, .URL, .URLClassLoader, .URI, java.nio.channels.*, java.nio.file.*, .DirectoryStream.Filter, java.nio.file.attribute.*, java.nio.file.spi.FileSystemProvider, java.security.AccessController, .PrivilegedAction, java.util.HashMap, .Map, .Objects, .Set, java.util.concurrent.ExecutorService

File system provider for jrt file systems. Conditionally creates jrt fs on .jimage file or exploded modules directory of underlying JDK.

Implementation Note

This class needs to maintain JDK 8 source compatibility. It is used internally in the JDK to implement jimage/jrtfs access, but also compiled and delivered as part of the jrtfs.jar to support access to the jimage file provided by the shipped JDK by tools running on JDK 8.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final String
private volatile FileSystem

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
checkAccess(Path path, AccessMode... modes)

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

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

private void
checkPermission()

Need RuntimePermission "accessSystemModules" to create or get jrt:/

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

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

Copy a file to a target file.

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

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

Creates a new directory.

public final void
delete(Path path)

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

Deletes a file.

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

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

Returns a file attribute view of a given type.

public FileStore
getFileStore(Path path)

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

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

public FileSystem
getFileSystem(URI uri)

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

Returns an existing FileSystem created by this provider.

public Path
getPath(URI uri)

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

Return a Path object by converting the given URI.

public String
getScheme()

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

Returns the URI scheme that identifies this provider.

private FileSystem
public boolean
isHidden(Path path)

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

Tells whether or not a file is considered hidden.

public boolean
isSameFile(Path path, Path other)

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

Tests if two paths locate the same file.

public void
move(Path src, 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 path, Set<? extends OpenOption> options, ExecutorService exec, 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 path, 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 path, 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 path, 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.

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

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

Constructs a new FileSystem object identified by a URI.

private FileSystem
newFileSystem(String targetHome, URI uri, Map<String, ?> env)

public InputStream
newInputStream(Path path, OpenOption... options)

Overrides java.nio.file.spi.FileSystemProvider.newInputStream.

Opens a file, returning an input stream to read from the file.

private static URLClassLoader
public OutputStream
newOutputStream(Path path, OpenOption... options)

Overrides java.nio.file.spi.FileSystemProvider.newOutputStream.

Opens or creates a file, returning an output stream that may be used to write bytes to the file.

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

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

Reads a file's attributes as a bulk operation.

public Map<String, Object>
readAttributes(Path path, String attribute, LinkOption... options)

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

Reads a set of file attributes as a bulk operation.

public void
setAttribute(Path path, String attribute, Object value, LinkOption... options)

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

Sets the value of a file attribute.

pack-priv static final JrtPath
Inherited from java.nio.file.spi.FileSystemProvider:
createLinkcreateSymbolicLinkdeleteIfExistsexistsinstalledProvidersnewFileSystemreadAttributesIfExists

Field Detail

JRT_FS_JARback to summary
private static final String JRT_FS_JAR
theFileSystemback to summary
private volatile FileSystem theFileSystem

Constructor Detail

JrtFileSystemProviderback to summary
public JrtFileSystemProvider()

Method Detail

checkAccessback to summary
public void checkAccess(Path path, 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
checkPermissionback to summary
private void checkPermission()

Need RuntimePermission "accessSystemModules" to create or get jrt:/

Annotations
@SuppressWarnings:removal
checkUriback to summary
private void checkUri(URI uri)
copyback to summary
public void copy(Path src, 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 path, 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
deleteback to summary
public final void delete(Path path) throws IOException

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

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

Deletes a file. This method works in exactly the manner specified by the Files#delete method.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getFileAttributeViewback to summary
public <V extends FileAttributeView> V getFileAttributeView(Path path, 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
getFileStoreback to summary
public FileStore getFileStore(Path path) 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 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
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 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
getTheFileSystemback to summary
private FileSystem getTheFileSystem()
isHiddenback to summary
public boolean isHidden(Path path)

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
isSameFileback to summary
public boolean isSameFile(Path path, Path other) 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
moveback to summary
public void move(Path src, 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 path, Set<? extends OpenOption> options, ExecutorService exec, 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 path, 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 path, 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 path, 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
public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException

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
Exceptions
IOException:
An I/O error occurs creating the file system
newFileSystemback to summary
private FileSystem newFileSystem(String targetHome, URI uri, Map<String, ?> env) throws IOException
newInputStreamback to summary
public InputStream newInputStream(Path path, OpenOption... options) throws IOException

Overrides java.nio.file.spi.FileSystemProvider.newInputStream.

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

Opens a file, returning an input stream to read from the file. This method works in exactly the manner specified by the Files#newInputStream method.

The default implementation of this method opens a channel to the file as if by invoking the newByteChannel method and constructs a stream that reads bytes from the channel. This method should be overridden where appropriate.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
newJrtFsLoaderback to summary
private static URLClassLoader newJrtFsLoader(Path jrtfs)
Annotations
@SuppressWarnings:removal, suppression
newOutputStreamback to summary
public OutputStream newOutputStream(Path path, OpenOption... options) throws IOException

Overrides java.nio.file.spi.FileSystemProvider.newOutputStream.

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

Opens or creates a file, returning an output stream that may be used to write bytes to the file. This method works in exactly the manner specified by the Files#newOutputStream method.

The default implementation of this method opens a channel to the file as if by invoking the newByteChannel method and constructs a stream that writes bytes to the channel. This method should be overridden where appropriate.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
readAttributesback to summary
public <A extends BasicFileAttributes> A readAttributes(Path path, 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
readAttributesback to summary
public Map<String, Object> readAttributes(Path path, String attribute, LinkOption... options) throws IOException

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

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

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

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
setAttributeback to summary
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException

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

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

Sets the value of a file attribute. This method works in exactly the manner specified by the Files#setAttribute method.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
toJrtPathback to summary
pack-priv static final JrtPath toJrtPath(Path path)
jdk.internal.jrtfs back to summary

private Class JrtFileSystemProvider.JrtFsLoader

extends URLClassLoader
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv
JrtFsLoader(URL[] urls)

Method Summary

Modifier and TypeMethod and Description
protected Class<?>
loadClass(String cn, boolean resolve)

Overrides java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name.

Inherited from java.net.URLClassLoader:
addURLclosedefinePackagefindClassfindResourcefindResourcesgetPermissionsgetResourceAsStreamgetURLsnewInstancenewInstance

Constructor Detail

JrtFsLoaderback to summary
pack-priv JrtFsLoader(URL[] urls)

Method Detail

loadClassback to summary
protected Class<?> loadClass(String cn, boolean resolve) throws ClassNotFoundException

Overrides java.lang.ClassLoader.loadClass.

Doc from java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:

  1. Invoke findLoadedClass(String) to check if the class has already been loaded.

  2. Invoke the loadClass method on the parent class loader. If the parent is null the class loader built into the virtual machine is used, instead.

  3. Invoke the findClass(String) method to find the class.

If the class was found using the above steps, and the resolve flag is true, this method will then invoke the resolveClass(Class) method on the resulting Class object.

Subclasses of ClassLoader are encouraged to override findClass(String), rather than this method.

Unless overridden, this method synchronizes on the result of getClassLoadingLock method during the entire class loading process.

Annotations
@Override
Exceptions
ClassNotFoundException:
If the class could not be found