Class JimfsFileSystemProvider


  • final class JimfsFileSystemProvider
    extends java.nio.file.spi.FileSystemProvider
    FileSystemProvider implementation for Jimfs. This provider implements the actual file system operations but does not handle creation, caching or lookup of file systems. See SystemJimfsFileSystemProvider, which is the META-INF/services/ entry for Jimfs, for those operations.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkAccess​(java.nio.file.Path path, java.nio.file.AccessMode... modes)  
      private static JimfsPath checkPath​(java.nio.file.Path path)  
      private void copy​(java.nio.file.Path source, java.nio.file.Path target, com.google.common.collect.ImmutableSet<java.nio.file.CopyOption> options, boolean move)  
      void copy​(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options)  
      void createDirectory​(java.nio.file.Path dir, java.nio.file.attribute.FileAttribute<?>... attrs)  
      void createLink​(java.nio.file.Path link, java.nio.file.Path existing)  
      void createSymbolicLink​(java.nio.file.Path link, java.nio.file.Path target, java.nio.file.attribute.FileAttribute<?>... attrs)  
      void delete​(java.nio.file.Path path)  
      private static FileSystemView getDefaultView​(JimfsPath path)
      Returns the default file system view for the given path.
      <V extends java.nio.file.attribute.FileAttributeView>
      @Nullable V
      getFileAttributeView​(java.nio.file.Path path, java.lang.Class<V> type, java.nio.file.LinkOption... options)  
      java.nio.file.FileStore getFileStore​(java.nio.file.Path path)  
      java.nio.file.FileSystem getFileSystem​(java.net.URI uri)  
      private static JimfsFileSystem getFileSystem​(java.nio.file.Path path)
      Gets the file system for the given path.
      java.nio.file.Path getPath​(java.net.URI uri)  
      java.lang.String getScheme()  
      (package private) static JimfsFileSystemProvider instance()
      Returns the singleton instance of this provider.
      boolean isHidden​(java.nio.file.Path path)  
      boolean isSameFile​(java.nio.file.Path path, java.nio.file.Path path2)  
      void move​(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options)  
      java.nio.channels.AsynchronousFileChannel newAsynchronousFileChannel​(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, @Nullable java.util.concurrent.ExecutorService executor, java.nio.file.attribute.FileAttribute<?>... attrs)  
      java.nio.channels.SeekableByteChannel newByteChannel​(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs)  
      java.nio.file.DirectoryStream<java.nio.file.Path> newDirectoryStream​(java.nio.file.Path dir, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter)  
      java.nio.channels.FileChannel newFileChannel​(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs)  
      java.nio.file.FileSystem newFileSystem​(java.net.URI uri, java.util.Map<java.lang.String,​?> env)  
      java.nio.file.FileSystem newFileSystem​(java.nio.file.Path path, java.util.Map<java.lang.String,​?> env)  
      java.io.InputStream newInputStream​(java.nio.file.Path path, java.nio.file.OpenOption... options)  
      private JimfsFileChannel newJimfsFileChannel​(JimfsPath path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs)  
      java.io.OutputStream newOutputStream​(java.nio.file.Path path, java.nio.file.OpenOption... options)  
      <A extends java.nio.file.attribute.BasicFileAttributes>
      A
      readAttributes​(java.nio.file.Path path, java.lang.Class<A> type, java.nio.file.LinkOption... options)  
      java.util.Map<java.lang.String,​java.lang.Object> readAttributes​(java.nio.file.Path path, java.lang.String attributes, java.nio.file.LinkOption... options)  
      java.nio.file.Path readSymbolicLink​(java.nio.file.Path link)  
      void setAttribute​(java.nio.file.Path path, java.lang.String attribute, java.lang.Object value, java.nio.file.LinkOption... options)  
      • Methods inherited from class java.nio.file.spi.FileSystemProvider

        deleteIfExists, installedProviders
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NO_ATTRS

        private static final java.nio.file.attribute.FileAttribute<?>[] NO_ATTRS
    • Constructor Detail

      • JimfsFileSystemProvider

        JimfsFileSystemProvider()
    • Method Detail

      • getScheme

        public java.lang.String getScheme()
        Specified by:
        getScheme in class java.nio.file.spi.FileSystemProvider
      • newFileSystem

        public java.nio.file.FileSystem newFileSystem​(java.net.URI uri,
                                                      java.util.Map<java.lang.String,​?> env)
                                               throws java.io.IOException
        Specified by:
        newFileSystem in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • newFileSystem

        public java.nio.file.FileSystem newFileSystem​(java.nio.file.Path path,
                                                      java.util.Map<java.lang.String,​?> env)
                                               throws java.io.IOException
        Overrides:
        newFileSystem in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • getFileSystem

        public java.nio.file.FileSystem getFileSystem​(java.net.URI uri)
        Specified by:
        getFileSystem in class java.nio.file.spi.FileSystemProvider
      • getFileSystem

        private static JimfsFileSystem getFileSystem​(java.nio.file.Path path)
        Gets the file system for the given path.
      • getPath

        public java.nio.file.Path getPath​(java.net.URI uri)
        Specified by:
        getPath in class java.nio.file.spi.FileSystemProvider
      • checkPath

        private static JimfsPath checkPath​(java.nio.file.Path path)
      • getDefaultView

        private static FileSystemView getDefaultView​(JimfsPath path)
        Returns the default file system view for the given path.
      • newFileChannel

        public java.nio.channels.FileChannel newFileChannel​(java.nio.file.Path path,
                                                            java.util.Set<? extends java.nio.file.OpenOption> options,
                                                            java.nio.file.attribute.FileAttribute<?>... attrs)
                                                     throws java.io.IOException
        Overrides:
        newFileChannel in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • newJimfsFileChannel

        private JimfsFileChannel newJimfsFileChannel​(JimfsPath path,
                                                     java.util.Set<? extends java.nio.file.OpenOption> options,
                                                     java.nio.file.attribute.FileAttribute<?>... attrs)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • newByteChannel

        public java.nio.channels.SeekableByteChannel newByteChannel​(java.nio.file.Path path,
                                                                    java.util.Set<? extends java.nio.file.OpenOption> options,
                                                                    java.nio.file.attribute.FileAttribute<?>... attrs)
                                                             throws java.io.IOException
        Specified by:
        newByteChannel in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • newAsynchronousFileChannel

        public java.nio.channels.AsynchronousFileChannel newAsynchronousFileChannel​(java.nio.file.Path path,
                                                                                    java.util.Set<? extends java.nio.file.OpenOption> options,
                                                                                    @Nullable java.util.concurrent.ExecutorService executor,
                                                                                    java.nio.file.attribute.FileAttribute<?>... attrs)
                                                                             throws java.io.IOException
        Overrides:
        newAsynchronousFileChannel in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • newInputStream

        public java.io.InputStream newInputStream​(java.nio.file.Path path,
                                                  java.nio.file.OpenOption... options)
                                           throws java.io.IOException
        Overrides:
        newInputStream in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • newOutputStream

        public java.io.OutputStream newOutputStream​(java.nio.file.Path path,
                                                    java.nio.file.OpenOption... options)
                                             throws java.io.IOException
        Overrides:
        newOutputStream in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • newDirectoryStream

        public java.nio.file.DirectoryStream<java.nio.file.Path> newDirectoryStream​(java.nio.file.Path dir,
                                                                                    java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter)
                                                                             throws java.io.IOException
        Specified by:
        newDirectoryStream in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • createDirectory

        public void createDirectory​(java.nio.file.Path dir,
                                    java.nio.file.attribute.FileAttribute<?>... attrs)
                             throws java.io.IOException
        Specified by:
        createDirectory in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • createLink

        public void createLink​(java.nio.file.Path link,
                               java.nio.file.Path existing)
                        throws java.io.IOException
        Overrides:
        createLink in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • createSymbolicLink

        public void createSymbolicLink​(java.nio.file.Path link,
                                       java.nio.file.Path target,
                                       java.nio.file.attribute.FileAttribute<?>... attrs)
                                throws java.io.IOException
        Overrides:
        createSymbolicLink in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • readSymbolicLink

        public java.nio.file.Path readSymbolicLink​(java.nio.file.Path link)
                                            throws java.io.IOException
        Overrides:
        readSymbolicLink in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • delete

        public void delete​(java.nio.file.Path path)
                    throws java.io.IOException
        Specified by:
        delete in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • copy

        public void copy​(java.nio.file.Path source,
                         java.nio.file.Path target,
                         java.nio.file.CopyOption... options)
                  throws java.io.IOException
        Specified by:
        copy in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • copy

        private void copy​(java.nio.file.Path source,
                          java.nio.file.Path target,
                          com.google.common.collect.ImmutableSet<java.nio.file.CopyOption> options,
                          boolean move)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • move

        public void move​(java.nio.file.Path source,
                         java.nio.file.Path target,
                         java.nio.file.CopyOption... options)
                  throws java.io.IOException
        Specified by:
        move in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • isSameFile

        public boolean isSameFile​(java.nio.file.Path path,
                                  java.nio.file.Path path2)
                           throws java.io.IOException
        Specified by:
        isSameFile in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • isHidden

        public boolean isHidden​(java.nio.file.Path path)
                         throws java.io.IOException
        Specified by:
        isHidden in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • getFileStore

        public java.nio.file.FileStore getFileStore​(java.nio.file.Path path)
                                             throws java.io.IOException
        Specified by:
        getFileStore in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • checkAccess

        public void checkAccess​(java.nio.file.Path path,
                                java.nio.file.AccessMode... modes)
                         throws java.io.IOException
        Specified by:
        checkAccess in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • getFileAttributeView

        public <V extends java.nio.file.attribute.FileAttributeView> @Nullable V getFileAttributeView​(java.nio.file.Path path,
                                                                                                      java.lang.Class<V> type,
                                                                                                      java.nio.file.LinkOption... options)
        Specified by:
        getFileAttributeView in class java.nio.file.spi.FileSystemProvider
      • readAttributes

        public <A extends java.nio.file.attribute.BasicFileAttributes> A readAttributes​(java.nio.file.Path path,
                                                                                        java.lang.Class<A> type,
                                                                                        java.nio.file.LinkOption... options)
                                                                                 throws java.io.IOException
        Specified by:
        readAttributes in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • readAttributes

        public java.util.Map<java.lang.String,​java.lang.Object> readAttributes​(java.nio.file.Path path,
                                                                                     java.lang.String attributes,
                                                                                     java.nio.file.LinkOption... options)
                                                                              throws java.io.IOException
        Specified by:
        readAttributes in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
      • setAttribute

        public void setAttribute​(java.nio.file.Path path,
                                 java.lang.String attribute,
                                 java.lang.Object value,
                                 java.nio.file.LinkOption... options)
                          throws java.io.IOException
        Specified by:
        setAttribute in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException