Package-level declarations

Types

Link copied to clipboard

JvmResourceResolver 的更安全的抽象类型,将 resolveUnknown 固定为 final

Link copied to clipboard

JvmResourceValueResolver 的更安全的抽象类型, 会将部分直接解析 Resource 的函数固定为 final

Link copied to clipboard

直接使用 ByteArray 作为 data 结果的 Resource 实现。

Link copied to clipboard

FileResource 接口表示一个可从文件获取流的资源。 该接口提供一个 File 对象和两种方法来获取输入流和读取文件的字节数组。

Link copied to clipboard

能够获取到 InputStream 资源的 Resource 扩展实现。

Link copied to clipboard

JVM 平台下 ResourceResolver 的进一步扩展类型。

Link copied to clipboard

基于 Resource 中的值进行处理。 其中,如果 URI.scheme == "file" 则会被处理为 Path.

Link copied to clipboard

JVM 平台下可以读取到字符串内容的 StringReadableResource 类型。 与 StringReadableResource 相比,对相关方法增加了 Charset 参数。 默认情况下使用 Charsets.UTF_8 格式编码。

Link copied to clipboard

PathResource 接口表示一个可从 Path 获取流的资源。 该接口提供一个 Path 对象和两种方法来获取输入流和读取文件的字节数组。

Link copied to clipboard

能够获取到 Reader 资源的 Resource 扩展实现。

Link copied to clipboard
interface Resource

一个资源

Link copied to clipboard
Link copied to clipboard
interface ResourceResolver<C>

使用 ResourceResolver 分析处理一个 Resource. 类似于 visitor 的用法,与常见地访问器区别于通常情况下只会有一个 resolve* 会最终执行。

Link copied to clipboard

一个可以得到 kotlinx.io.SourceResource

Link copied to clipboard

一个可以读取到 String 内容物的拓展类型。 是其他 Resource 类型的附加能力,但不属于一个标准的 Resource 类型。

Link copied to clipboard

直接使用 String 作为内容的 Resource

Link copied to clipboard

URIResource 是一个输入流资源的接口。

Functions

Link copied to clipboard
@JvmName(name = "valueOfPath")
fun fileResource(filePath: String): Resource

根据完整的文件路径 filePath 得到一个基于对应文件的 Resource

@JvmName(name = "valueOfPath")
fun fileResource(base: String, vararg parts: String): Resource

根据文件路径片段集得到一个基于对应文件的 Resource

Inherited functions

Link copied to clipboard

通过提供的 ByteArray 直接构建一个 Resource

@JvmName(name = "valueOf")
fun File.toResource(charset: Charset = JvmStringReadableResource.DEFAULT_CHARSET): FileResource

Converts a File to a FileResource. charset 会作为需要使用编码参数的方法的默认编码。 默认使用 JvmStringReadableResource.DEFAULT_CHARSET

@JvmName(name = "valueOf")
fun URI.toResource(charset: Charset = JvmStringReadableResource.DEFAULT_CHARSET): URIResource

Converts the current URI to a URIResource.

@JvmName(name = "valueOf")
fun URL.toResource(charset: Charset = JvmStringReadableResource.DEFAULT_CHARSET): URIResource

Converts the current URL to a URIResource.

@JvmName(name = "valueOf")
fun Path.toResource(charset: Charset = JvmStringReadableResource.DEFAULT_CHARSET, vararg options: OpenOption): PathResource

Converts the given Path to a PathResource with the specified options.

Link copied to clipboard

通过提供的 String 直接构建一个 StringResource