Package org.pkl.core.resource
Class ResourceReaders
java.lang.Object
org.pkl.core.resource.ResourceReaders
Predefined resource readers for OS environment variables and external properties.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceReaderclassPath(ClassLoader classLoader) A resource reader for JVM class path resources.static ResourceReaderA resource reader for OS environment variables.static ResourceReaderexternalProcess(String scheme, ExternalReaderProcess process) Returns a reader for external reader resources.static ResourceReaderexternalProcess(String scheme, ExternalReaderProcess process, long evaluatorId) Returns a reader for external reader resources.static ResourceReaderA resource reader for external properties.static ResourceReaderexternalResolver(ResourceReaderSpec spec, ExternalResourceResolver resolver) Returns a reader for external and client reader resources.static ResourceReaderfile()static List<ResourceReader> Returns resource readers registered asservice providersof typeorg.pkl.core.resource.ResourceReader.static ResourceReaderhttp()A resource reader for HTTP resources.static ResourceReaderhttps()A resource reader for HTTPS resources.static ResourceReadermodulePath(ModulePathResolver resolver) A resource reader for Pkl module path (--module-path) resources.static ResourceReaderpkg()A resource reader forpackage:resources.static ResourceReader
-
Method Details
-
environmentVariable
A resource reader for OS environment variables. If this resource reader is present, Pkl code can read environment variableFOO_BARwithread("env:FOO_BAR"), provided that resource URIenv:FOO_BARmatches an entry in the resource allowlist (--allowed-resources). -
externalProperty
A resource reader for external properties. If this resource reader is present, Pkl code can read external propertyfoo.barwithread("prop:foo.bar"), provided that resource URIprop:foo.barmatches an entry in the resource allowlist (--allowed-resources). -
file
-
http
A resource reader for HTTP resources. If this resource reader is present, Pkl code can read HTTP resourcehttp://apple.com/foo/bar.txtwithread("http://apple.com/foo/bar.txt"), provided that resource URI"http://apple.com/foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources). -
https
A resource reader for HTTPS resources. If this resource reader is present, Pkl code can read HTTPS resourcehttps://apple.com/foo/bar.txtwithread("https://apple.com/foo/bar.txt"), provided that resource URI"https://apple.com/foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources). -
classPath
A resource reader for JVM class path resources. If this resource reader is present, Pkl code can read class path resource/foo/bar.txtwithread("modulepath:foo/bar.txt"), provided that resource URI"modulepath:foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources). -
modulePath
A resource reader for Pkl module path (--module-path) resources. If this resource reader is present, Pkl code can read module path resource/foo/bar.txtwithread("modulepath:foo/bar.txt"), provided that resource URI"modulepath:foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources). -
pkg
A resource reader forpackage:resources. If this resource reader is present, Pkl code can read resources from within packages withread("package://example.com/foo@1.0.0#/foo.txt"), or using dependency notation withread("@foo/foo.txt")assuming that the Pkl module is within a project that declares a dependency namedfoo. -
projectpackage
-
fromServiceProviders
Returns resource readers registered asservice providersof typeorg.pkl.core.resource.ResourceReader. -
externalProcess
Returns a reader for external reader resources.NOTE:
processneeds to beclosedto avoid resource leaks. -
externalProcess
public static ResourceReader externalProcess(String scheme, ExternalReaderProcess process, long evaluatorId) Returns a reader for external reader resources.NOTE:
processneeds to beclosedto avoid resource leaks. -
externalResolver
public static ResourceReader externalResolver(ResourceReaderSpec spec, ExternalResourceResolver resolver) Returns a reader for external and client reader resources.
-