public class RemotePathMapper extends java.lang.Object implements RemotePathResolver
RemotePathResolver using a configured remote-to-local
map.| Constructor and Description |
|---|
RemotePathMapper(java.util.List<RemoteMount> remoteToLocalMap)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
java.nio.file.Path |
forceLocalPath(java.net.URI path)
Same as
toLocalPath, but forcibly converts
the input into a local path instead of returning empty when it can't
be resolved using remote-to-local mappings. |
java.util.Optional<java.nio.file.Path> |
toLocalPath(java.net.URI remotePath)
Resolves a remote path into a local one.
|
public RemotePathMapper(java.util.List<RemoteMount> remoteToLocalMap)
remoteToLocalMap - remote-to-local base path mappings.java.lang.NullPointerException - if the argument is null.public java.util.Optional<java.nio.file.Path> toLocalPath(java.net.URI remotePath)
RemotePathResolverRemoteMount. If no remote-to-local
mappings have been configured or none of them can be used to resolve
the remote path, then empty is returned.toLocalPath in interface RemotePathResolverremotePath - a file URI pointing to a file on a remote device
connected to this machine through a suitable mount
point.public java.nio.file.Path forceLocalPath(java.net.URI path)
RemotePathResolvertoLocalPath, but forcibly converts
the input into a local path instead of returning empty when it can't
be resolved using remote-to-local mappings.
Here "forcibly" means we blindly assume the URI is that of a local
file that the Paths can convert to a Path.forceLocalPath in interface RemotePathResolverpath - a file URI pointing to a file on a remote device connected
to this machine through a suitable mount point or a file URI
of a local file.