public final class SMBFileSystemProvider extends FileSystemProvider
| Constructor and Description |
|---|
SMBFileSystemProvider()
Default constructor for
SMBFileSystemProvider. |
| Modifier and Type | Method and Description |
|---|---|
void |
checkAccess(Path path,
AccessMode... modes)
Checks access to file under the provided
SMBPath. |
void |
copy(Path source,
Path target,
CopyOption... options)
|
void |
createDirectory(Path dir,
FileAttribute<?>... attrs)
Creates a directory under the provided
SMBPath |
void |
delete(Path path)
Deletes the file under the provided
SMBPath |
<V extends FileAttributeView> |
getFileAttributeView(Path path,
Class<V> type,
LinkOption... options)
Reads the file attributes view of the file under the provided
SMBPath and returns it. |
FileStore |
getFileStore(Path path) |
SMBFileSystem |
getFileSystem(URI uri)
Retrieves a
SMBFileSystem instance for the provided URI from fileSystemCache and returns it. |
SMBPath |
getPath(URI uri)
Converts the provided URI to an
SMBPath instance and returns it. |
String |
getScheme()
Returns the default scheme for
SMBFileSystemProvider. |
boolean |
isHidden(Path path)
Returns true, if the resource specified by the provided
SMBPath instance is hidden.. |
boolean |
isSameFile(Path path1,
Path path2)
Returns true, if the resources specified by the two
SMBPath instance are the same. |
void |
move(Path source,
Path target,
CopyOption... options)
|
SeekableByteChannel |
newByteChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
Creates and returns a new
SeekableSMBByteChannel instance. |
DirectoryStream<Path> |
newDirectoryStream(Path dir,
DirectoryStream.Filter<? super Path> filter)
Creates and returns a new
SMBDirectoryStream for the specified path. |
SMBFileSystem |
newFileSystem(URI uri,
Map<String,?> env)
Creates a new
SMBFileSystem instance for the provided URI. |
<A extends BasicFileAttributes> |
readAttributes(Path path,
Class<A> type,
LinkOption... options)
Reads the file attributes of the file under the provided
SMBPath and returns it. |
Map<String,Object> |
readAttributes(Path path,
String attributes,
LinkOption... options) |
void |
setAttribute(Path path,
String attribute,
Object value,
LinkOption... options) |
createLink, createSymbolicLink, deleteIfExists, installedProviders, newAsynchronousFileChannel, newFileChannel, newFileSystem, newInputStream, newOutputStream, readSymbolicLinkpublic SMBFileSystemProvider()
SMBFileSystemProvider.public String getScheme()
SMBFileSystemProvider.getScheme in class FileSystemProviderpublic SMBFileSystem newFileSystem(URI uri, Map<String,?> env)
SMBFileSystem instance for the provided URI. SMBFileSystem instances are cached based
on the authority part of the URI (i.e. URI's with the same authority share the same SMBFileSystem instance).
Credentials for connecting with the SMB/CIFS server can be provided in several ways:
newFileSystem in class FileSystemProvideruri - URI for which to create SMBFileSystemenv - Map containing configuration parameters.SMBFileSystem instanceFileSystemAlreadyExistsException - If an instance of SMBFileSystem already exists for provided URI.IllegalArgumentException - If provided URI is not an SMB URI.public SMBFileSystem getFileSystem(URI uri)
SMBFileSystem instance for the provided URI from fileSystemCache and returns it. SMBFileSystem instances
are cached based on the authority part of the URI (i.e. URI's with the same authority share the same SMBFileSystem instance).getFileSystem in class FileSystemProvideruri - URI for which to fetch SMBFileSystemSMBFileSystem instanceFileSystemNotFoundException - If no instance of SMBFileSystem could be retrieved from fileSystemCache.IllegalArgumentException - If provided URI is not an SMB URI.public SMBPath getPath(URI uri)
SMBPath instance and returns it. Automatically links the SMBPath
with the SMBFileSystem associated with its authority.getPath in class FileSystemProvideruri - The URI from which to create the SMBPathSMBPath.IllegalArgumentException - If URI is not an SMB URI.public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
SeekableSMBByteChannel instance.newByteChannel in class FileSystemProviderpath - The SMBPath for which a byte channel should be opened.options - A set of StandardOpenOptions.attrs - An optional list of file attributes to set when creating the file.SeekableSMBByteChannel.IllegalArgumentException - If provided path is not an SMBPath instance.IOException - If an I/O error occursUnsupportedOperationException - If an unsupported open option is specified (DSYNC, SYNC or SPARSE)public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException
SMBDirectoryStream for the specified path.newDirectoryStream in class FileSystemProviderdir - The SMBPath for which to create a new DirectoryStream.filter - An optional filter that should be applied to filter entries in the stream.SMBDirectoryStream.IllegalArgumentException - If provided path is not an SMBPath instance.NotDirectoryException - If provided SMBPath does not point to a directoryIOException - If an I/O error occurspublic void createDirectory(Path dir, FileAttribute<?>... attrs) throws IOException
SMBPathcreateDirectory in class FileSystemProviderdir - SMBPath to folder that should be created.IllegalArgumentException - If provided path is not an SMBPath instance.IOException - If creating the folder fails for some reason.public void delete(Path path) throws IOException
SMBPathdelete in class FileSystemProviderpath - SMBPath to file that should be deleted.IllegalArgumentException - If provided path is not an SMBPath instance.IOException - If deleting the file fails for some reason.public void copy(Path source, Path target, CopyOption... options) throws IOException
copy in class FileSystemProvidersource - Source SMBPathtarget - Destination SMBPathoptions - CopyOptions (no effect)IllegalArgumentException - If provided paths are not SMBPath instances.IOException - If copying fails for some reason.public void move(Path source, Path target, CopyOption... options) throws IOException
SMBPath to the destination SMBPath.
CopyOptions are ignored!move in class FileSystemProvidersource - Source SMBPathtarget - Destination SMBPathoptions - CopyOptions (no effect)IllegalArgumentException - If provided paths are not SMBPath instances.IOException - If moving fails for some reason.public boolean isSameFile(Path path1, Path path2) throws IOException
SMBPath instance are the same.isSameFile in class FileSystemProviderpath1 - First SMBPathpath2 - Second SMBPathIllegalArgumentException - If provided paths are not SMBPath instances.IOException - If moving fails for some reason.public boolean isHidden(Path path) throws IOException
SMBPath instance is hidden..isHidden in class FileSystemProviderpath - SMBPath that should be checked.SMBPath is hidden.IllegalArgumentException - If provided paths are not SMBPath instances.IOException - If moving fails for some reason.public void checkAccess(Path path, AccessMode... modes) throws IOException
SMBPath.checkAccess in class FileSystemProviderpath - SMBPath for which access should be checked.modes - AccessModes that should be checked. Onl yREAD and WRITE are supported.NoSuchFileException - If file or folder specified by SMBPath does not exist.AccessDeniedException - If requested access cannot be provided for file or folder under SMBPath.IllegalArgumentException - If provided path is not a SMBPath instance.IOException - If checking accessfails for some reason.public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options)
SMBPath and returns it. LinkOption will be ignored as
the SMB filesystem does not support symlinks.getFileAttributeView in class FileSystemProviderV - Type of the class that's being returned.path - SMBPath for which attributes view should be created.type - Class of the attributes view. Must be either BasicFileAttributeView or SMBFileAttributeViewoptions - LinkOptions; will be ignored.SMBFileAttributeViewIllegalArgumentException - If provided paths is not a SMBPath instance.public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
SMBPath and returns it. LinkOption will be ignored as
the SMB filesystem does not support symlinks.readAttributes in class FileSystemProviderA - Type of the class that's being returned.path - SMBPath for which attributes should be read.type - Class of the attribute. Must be either BasicFileAttributes or SMBFileAttributesoptions - LinkOptions; will be ignored.SMBFileAttributesIllegalArgumentException - If provided paths is not a SMBPath instance.IOException - If reading attributes fails for some reason.public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options)
readAttributes in class FileSystemProviderpublic void setAttribute(Path path, String attribute, Object value, LinkOption... options)
setAttribute in class FileSystemProviderpublic FileStore getFileStore(Path path)
getFileStore in class FileSystemProviderCopyright © 2020 pontius software GmbH. All rights reserved.