Class ShrinkWrapFileSystemProvider


  • public class ShrinkWrapFileSystemProvider
    extends java.nio.file.spi.FileSystemProvider
    FileSystemProvider implementation for ShrinkWrap Archives.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.ConcurrentMap<java.lang.String,​ShrinkWrapFileSystem> createdFileSystems
      Open file systems, keyed by the Archive.getId()
      private java.util.concurrent.locks.ReentrantLock createNewFsLock
      Lock for creation of a new filesystem and other tasks which should block until this op has completed
      private static java.lang.String ENV_KEY_ARCHIVE
      Environment key for creating a new FileSystem denoting the archive
      private static java.util.logging.Logger log
      Logger
      private static java.lang.String SCHEME
      Scheme
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkAccess​(java.nio.file.Path path, java.nio.file.AccessMode... modes)
      private void copy​(java.io.InputStream in, java.nio.channels.SeekableByteChannel out)
      Writes the contents of the InputStream to the SeekableByteChannel
      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 delete​(java.nio.file.Path path)
      private Archive<?> getArchive​(java.nio.file.Path path)
      Obtains the underlying archive associated with the specified Path
      <V extends java.nio.file.attribute.FileAttributeView>
      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)
      java.nio.file.Path getPath​(java.net.URI uri)
      java.lang.String getScheme()
      boolean isHidden​(java.nio.file.Path path)
      boolean isSameFile​(java.nio.file.Path path1, 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.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)
      <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)
      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

        createLink, createSymbolicLink, deleteIfExists, installedProviders, newAsynchronousFileChannel, newFileSystem, newInputStream, newOutputStream, readSymbolicLink
      • Methods inherited from class java.lang.Object

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

      • log

        private static final java.util.logging.Logger log
        Logger
      • ENV_KEY_ARCHIVE

        private static final java.lang.String ENV_KEY_ARCHIVE
        Environment key for creating a new FileSystem denoting the archive
        See Also:
        Constant Field Values
      • createdFileSystems

        private final java.util.concurrent.ConcurrentMap<java.lang.String,​ShrinkWrapFileSystem> createdFileSystems
        Open file systems, keyed by the Archive.getId()
      • createNewFsLock

        private final java.util.concurrent.locks.ReentrantLock createNewFsLock
        Lock for creation of a new filesystem and other tasks which should block until this op has completed
    • Constructor Detail

      • ShrinkWrapFileSystemProvider

        public ShrinkWrapFileSystemProvider()
    • Method Detail

      • getScheme

        public java.lang.String getScheme()
        Specified by:
        getScheme in class java.nio.file.spi.FileSystemProvider
        See Also:
        FileSystemProvider.getScheme()
      • 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
        See Also:
        FileSystemProvider.newFileSystem(java.net.URI, java.util.Map)
      • getFileSystem

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

        public java.nio.file.Path getPath​(java.net.URI uri)
        Specified by:
        getPath in class java.nio.file.spi.FileSystemProvider
        See Also:
        FileSystemProvider.getPath(java.net.URI)
      • 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
        See Also:
        java.nio.file.spi.FileSystemProvider#newFileChannel(java.nio.file.Path, java.util.Set, java.nio.file.attribute.FileAttribute[])
      • 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
        See Also:
        java.nio.file.spi.FileSystemProvider#newByteChannel(java.nio.file.Path, java.util.Set, java.nio.file.attribute.FileAttribute[])
      • 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
        See Also:
        FileSystemProvider.newDirectoryStream(java.nio.file.Path, java.nio.file.DirectoryStream.Filter)
      • 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
        See Also:
        java.nio.file.spi.FileSystemProvider#createDirectory(java.nio.file.Path, java.nio.file.attribute.FileAttribute[])
      • 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
        See Also:
        FileSystemProvider.delete(java.nio.file.Path)
      • getArchive

        private Archive<?> getArchive​(java.nio.file.Path path)
        Obtains the underlying archive associated with the specified Path
        Parameters:
        path -
        Returns:
      • 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
      • 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
        See Also:
        FileSystemProvider.move(java.nio.file.Path, java.nio.file.Path, java.nio.file.CopyOption[])
      • isSameFile

        public boolean isSameFile​(java.nio.file.Path path1,
                                  java.nio.file.Path path2)
                           throws java.io.IOException
        Specified by:
        isSameFile in class java.nio.file.spi.FileSystemProvider
        Throws:
        java.io.IOException
        See Also:
        FileSystemProvider.isSameFile(java.nio.file.Path, java.nio.file.Path)
      • 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
        See Also:
        FileSystemProvider.isHidden(java.nio.file.Path)
      • 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
        See Also:
        FileSystemProvider.getFileStore(java.nio.file.Path)
      • 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
        See Also:
        FileSystemProvider.checkAccess(java.nio.file.Path, java.nio.file.AccessMode[])
      • getFileAttributeView

        public <V extends java.nio.file.attribute.FileAttributeView> 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
        See Also:
        FileSystemProvider.getFileAttributeView(java.nio.file.Path, java.lang.Class, java.nio.file.LinkOption[])
      • 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
        See Also:
        FileSystemProvider.readAttributes(java.nio.file.Path, java.lang.Class, java.nio.file.LinkOption[])
      • 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
        See Also:
        FileSystemProvider.readAttributes(java.nio.file.Path, java.lang.String, java.nio.file.LinkOption[])
      • 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
        See Also:
        FileSystemProvider.setAttribute(java.nio.file.Path, java.lang.String, java.lang.Object, java.nio.file.LinkOption[])
      • copy

        private void copy​(java.io.InputStream in,
                          java.nio.channels.SeekableByteChannel out)
                   throws java.io.IOException
        Writes the contents of the InputStream to the SeekableByteChannel
        Parameters:
        in -
        out -
        Throws:
        java.io.IOException