Skip to content

Commit

Permalink
optimize: 优化改善与 SourceResource 相关的API
Browse files Browse the repository at this point in the history
Signed-off-by: ForteScarlet <[email protected]>
  • Loading branch information
ForteScarlet committed Oct 23, 2024
1 parent 648ebbc commit 596bd6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public fun fileResource(base: String, vararg parts: String): Resource {
/**
* 一个可以得到 [kotlinx.io.Source] 的 [Resource]。
*
* @see fileResource
*
* @since 4.7.0
*/
@ExperimentalIOResourceAPI
Expand Down Expand Up @@ -146,7 +148,8 @@ public interface SourceResource : Resource {

@ExperimentalIOResourceAPI
private data class FilePathResource(val path: Path) : SourceResource {
private val source = SystemFileSystem.source(path)
private val source
get() = SystemFileSystem.source(path)

@Throws(Exception::class)
override fun source(): Source = source.buffered()
Expand Down

0 comments on commit 596bd6b

Please sign in to comment.