public static final class InternalResource.Env extends Object
| Modifier and Type | Method and Description |
|---|---|
InternalResource.CPUArchitecture |
getCPUArchitecture()
Returns the current processor architecture.
|
InternalResource.OS |
getOS()
Returns the current operating system.
|
boolean |
inContextPreinitialization()
Returns
true if the engine causing the resource unpacking is being
pre-initialized. |
boolean |
inNativeImageBuild()
Returns
true if resource unpacking happens during the native image build. |
List<String> |
readResourceLines(Path location)
Reads a resource from the module, which owns the
InternalResource implementation
class. |
void |
unpackResourceFiles(Path source,
Path target,
Path relativizeTo)
Extracts files from the module, which owns the
InternalResource implementation
class, listed in the source file list and places them into the target
folder. |
public boolean inContextPreinitialization()
true if the engine causing the resource unpacking is being
pre-initialized.public boolean inNativeImageBuild()
true if resource unpacking happens during the native image build.public InternalResource.CPUArchitecture getCPUArchitecture()
public InternalResource.OS getOS()
public List<String> readResourceLines(Path location) throws IOException
InternalResource implementation
class. If the resource is encapsulated in the module, see
Module.getResourceAsStream(String), the module needs to open the location
enclosing package to the org.graalvm.truffle module. It is recommended to use
non-encapsulated resource paths.location - relative path that identifies the resource in the module. The relative
path gets resolved into an absolute path using the archive root.ListIOException - in case of IO errorpublic void unpackResourceFiles(Path source, Path target, Path relativizeTo) throws IOException
InternalResource implementation
class, listed in the source file list and places them into the target
folder. If resources are encapsulated within the module, see
Module.getResourceAsStream(String), the module needs to open the enclosing
package of the resources to the org.graalvm.truffle module. It is recommended to
use non-encapsulated resource paths.
The file list is a Java properties file where resource files serve as
keys, and the corresponding values consist of serialized attributes separated by
','. Currently, only the POSIX file permissions attribute is supported. The
format of this attribute follows the same convention used by the
PosixFilePermissions.fromString(String).
Example of a file list content:
META-INF/resources/darwin/amd64/bin/libtrufflenfi.dylib = rwxr-xr-x META-INF/resources/common/include/trufflenfi.h = rw-r--r--
source - the relative path that identifies the file list resource in the module. The
relative path gets resolved into an absolute path using the archive root.target - the folder to extract resources torelativizeTo - the path used to relativize the file list entries in the
target folder. In other words, the file list entries are resolved
using the target directory after removing the relativizeTo
path.IllegalArgumentException - if relativizeTo is an absolute path or file list
contains an absolute pathIOException - in case of IO error