IResourceService¶
-
public interface
IResourceService
extends AutoCloseable¶ Interface for access to the virtual file system.
Methods¶
localFile¶
-
File
localFile
(FileObject resource)¶ Attempts to get a local file for given resource, or copies the resource to the local file system if it does not reside on the local file system.
Parameters: - resource – Resource to get a local file for.
Throws: - MetaborgRuntimeException – When given resource does not exist.
Returns: Local file.
localFile¶
-
File
localFile
(FileObject resource, FileObject dir)¶ Attempts to get a local file for given resource, or copies the resource to the local file system at given directory if it does not reside on the local file system.
Parameters: - resource – Resource to get a local file for.
- dir – Directory to copy the resources to if they are not on a local filesystem. Must be on the local filesystem.
Throws: - MetaborgRuntimeException – When given resource does not exist.
Returns: Local file.
localPath¶
-
File
localPath
(FileObject resource)¶ Attempts to get a local file handle for given resource.
Parameters: - resource – Resource to get a local file handle for.
Returns: Local file handle, or null if given resource does not reside on the local file system.
resolve¶
-
FileObject
resolve
(String uri)¶ Returns a file system object for given (absolute or relative to the root) URI. The given URI will be encoded (, /, and : symbols will not be encoded) in its entirely. If your URI is already encoded, convert it to an
URI
and callresolve(URI)
instead. See FVS file systems for examples of URIs.Parameters: - uri – Absolute or relative to the root URI to resolve.
Throws: - MetaborgRuntimeException – When
uri
is invalid.
Returns: File system object for given URI.
resolve¶
-
FileObject
resolve
(File file)¶ Returns a local file system object for given Java file system object.
Parameters: - file – Java file system object to resolve.
Throws: - MetaborgRuntimeException – When file is invalid.
Returns: File system object for given Java file system object.
resolve¶
-
FileObject
resolve
(URI uri)¶ Returns a file system object for given Java URI object. See FVS file systems for examples of URIs.
Parameters: - uri – Java URI object to resolve.
Throws: - MetaborgRuntimeException – When
uri
is invalid.
Returns: File system object for given Java URI object.
resolve¶
-
FileObject
resolve
(FileObject parent, String path)¶ Tries to resolve
path
as an absolute path first, if that fails, resolvespath
relative toparent
. Ifpath
is absolute but does not have a scheme, it is assumed to be on the local file system.Parameters: - parent – Parent file object to resolve relatively to, if
path
is a relative path. - path – Path to resolve
Throws: - MetaborgRuntimeException – When absolute or relative resolution fails.
Returns: File system object for given path.
- parent – Parent file object to resolve relatively to, if
resolveToName¶
-
FileName
resolveToName
(String uri)¶ Returns a file name for given URI. The given URI will be encoded (, /, and : symbols will not be encoded) in its entirely. If your URI is already encoded, convert it to an
URI
and callresolveToName(URI)
instead. See FVS file systems for examples of URIs.Parameters: - uri – URI to resolve to a name.
Throws: - MetaborgRuntimeException – When
uri
is invalid.
Returns: File name for given URI.
resolveToName¶
-
FileName
resolveToName
(URI uri)¶ Returns a file name for given Java URI object. See FVS file systems for examples of URIs.
Parameters: - uri – Java URI object to resolve to a name.
Throws: - MetaborgRuntimeException – When
uri
is invalid.
Returns: File name for given Java URI object.
root¶
-
FileObject
root
()¶ Returns the root file system object.
Throws: - MetaborgRuntimeException – if an error occurs.
Returns: The root file system object.