Package com.google.common.jimfs
Class JimfsFileSystemProvider
java.lang.Object
java.nio.file.spi.FileSystemProvider
com.google.common.jimfs.JimfsFileSystemProvider
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final JimfsFileSystemProvider
private static final FileAttribute<?>[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkAccess
(Path path, AccessMode... modes) private static JimfsPath
private void
copy
(Path source, Path target, com.google.common.collect.ImmutableSet<CopyOption> options, boolean move) void
copy
(Path source, Path target, CopyOption... options) void
createDirectory
(Path dir, FileAttribute<?>... attrs) void
createLink
(Path link, Path existing) void
createSymbolicLink
(Path link, Path target, FileAttribute<?>... attrs) void
private static FileSystemView
getDefaultView
(JimfsPath path) Returns the default file system view for the given path.<V extends FileAttributeView>
@Nullable VgetFileAttributeView
(Path path, Class<V> type, LinkOption... options) getFileStore
(Path path) getFileSystem
(URI uri) private static JimfsFileSystem
getFileSystem
(Path path) Gets the file system for the given path.(package private) static JimfsFileSystemProvider
instance()
Returns the singleton instance of this provider.boolean
boolean
isSameFile
(Path path, Path path2) void
move
(Path source, Path target, CopyOption... options) newAsynchronousFileChannel
(Path path, Set<? extends OpenOption> options, @Nullable ExecutorService executor, FileAttribute<?>... attrs) newByteChannel
(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) newDirectoryStream
(Path dir, DirectoryStream.Filter<? super Path> filter) newFileChannel
(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) newFileSystem
(URI uri, Map<String, ?> env) newFileSystem
(Path path, Map<String, ?> env) newInputStream
(Path path, OpenOption... options) private JimfsFileChannel
newJimfsFileChannel
(JimfsPath path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) newOutputStream
(Path path, OpenOption... options) <A extends BasicFileAttributes>
AreadAttributes
(Path path, Class<A> type, LinkOption... options) readAttributes
(Path path, String attributes, LinkOption... options) readSymbolicLink
(Path link) void
setAttribute
(Path path, String attribute, Object value, LinkOption... options) Methods inherited from class java.nio.file.spi.FileSystemProvider
deleteIfExists, exists, installedProviders, readAttributesIfExists
-
Field Details
-
INSTANCE
-
NO_ATTRS
-
-
Constructor Details
-
JimfsFileSystemProvider
JimfsFileSystemProvider()
-
-
Method Details
-
instance
Returns the singleton instance of this provider. -
getScheme
- Specified by:
getScheme
in classFileSystemProvider
-
newFileSystem
- Specified by:
newFileSystem
in classFileSystemProvider
- Throws:
IOException
-
newFileSystem
- Overrides:
newFileSystem
in classFileSystemProvider
- Throws:
IOException
-
getFileSystem
- Specified by:
getFileSystem
in classFileSystemProvider
-
getFileSystem
Gets the file system for the given path. -
getPath
- Specified by:
getPath
in classFileSystemProvider
-
checkPath
-
getDefaultView
Returns the default file system view for the given path. -
newFileChannel
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Overrides:
newFileChannel
in classFileSystemProvider
- Throws:
IOException
-
newJimfsFileChannel
private JimfsFileChannel newJimfsFileChannel(JimfsPath path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Throws:
IOException
-
newByteChannel
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Specified by:
newByteChannel
in classFileSystemProvider
- Throws:
IOException
-
newAsynchronousFileChannel
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, @Nullable ExecutorService executor, FileAttribute<?>... attrs) throws IOException - Overrides:
newAsynchronousFileChannel
in classFileSystemProvider
- Throws:
IOException
-
newInputStream
- Overrides:
newInputStream
in classFileSystemProvider
- Throws:
IOException
-
newOutputStream
- Overrides:
newOutputStream
in classFileSystemProvider
- Throws:
IOException
-
newDirectoryStream
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException - Specified by:
newDirectoryStream
in classFileSystemProvider
- Throws:
IOException
-
createDirectory
- Specified by:
createDirectory
in classFileSystemProvider
- Throws:
IOException
-
createLink
- Overrides:
createLink
in classFileSystemProvider
- Throws:
IOException
-
createSymbolicLink
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException - Overrides:
createSymbolicLink
in classFileSystemProvider
- Throws:
IOException
-
readSymbolicLink
- Overrides:
readSymbolicLink
in classFileSystemProvider
- Throws:
IOException
-
delete
- Specified by:
delete
in classFileSystemProvider
- Throws:
IOException
-
copy
- Specified by:
copy
in classFileSystemProvider
- Throws:
IOException
-
copy
private void copy(Path source, Path target, com.google.common.collect.ImmutableSet<CopyOption> options, boolean move) throws IOException - Throws:
IOException
-
move
- Specified by:
move
in classFileSystemProvider
- Throws:
IOException
-
isSameFile
- Specified by:
isSameFile
in classFileSystemProvider
- Throws:
IOException
-
isHidden
- Specified by:
isHidden
in classFileSystemProvider
- Throws:
IOException
-
getFileStore
- Specified by:
getFileStore
in classFileSystemProvider
- Throws:
IOException
-
checkAccess
- Specified by:
checkAccess
in classFileSystemProvider
- Throws:
IOException
-
getFileAttributeView
public <V extends FileAttributeView> @Nullable V getFileAttributeView(Path path, Class<V> type, LinkOption... options) - Specified by:
getFileAttributeView
in classFileSystemProvider
-
readAttributes
public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException - Specified by:
readAttributes
in classFileSystemProvider
- Throws:
IOException
-
readAttributes
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException - Specified by:
readAttributes
in classFileSystemProvider
- Throws:
IOException
-
setAttribute
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException - Specified by:
setAttribute
in classFileSystemProvider
- Throws:
IOException
-