You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
2 months ago
|
@file:OptIn(
|
||
|
org.jetbrains.compose.resources.InternalResourceApi::class,
|
||
|
org.jetbrains.compose.resources.ExperimentalResourceApi::class,
|
||
|
)
|
||
|
|
||
|
package my.lib.res
|
||
|
|
||
|
import kotlin.ByteArray
|
||
|
import kotlin.OptIn
|
||
|
import kotlin.String
|
||
|
import org.jetbrains.compose.resources.ExperimentalResourceApi
|
||
2 months ago
|
import org.jetbrains.compose.resources.getResourceUri
|
||
2 months ago
|
import org.jetbrains.compose.resources.readResourceBytes
|
||
|
|
||
|
@ExperimentalResourceApi
|
||
|
public object Res {
|
||
|
/**
|
||
|
* Reads the content of the resource file at the specified path and returns it as a byte array.
|
||
|
*
|
||
|
* Example: `val bytes = Res.readBytes("files/key.bin")`
|
||
|
*
|
||
|
* @param path The path of the file to read in the compose resource's directory.
|
||
|
* @return The content of the file as a byte array.
|
||
|
*/
|
||
|
public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path)
|
||
|
|
||
2 months ago
|
/**
|
||
|
* Returns the URI string of the resource file at the specified path.
|
||
|
*
|
||
|
* Example: `val uri = Res.getUri("files/key.bin")`
|
||
|
*
|
||
|
* @param path The path of the file in the compose resource's directory.
|
||
|
* @return The URI string of the file.
|
||
|
*/
|
||
|
public fun getUri(path: String): String = getResourceUri("" + path)
|
||
|
|
||
2 months ago
|
public object drawable
|
||
|
|
||
|
public object string
|
||
|
|
||
2 months ago
|
public object array
|
||
|
|
||
2 months ago
|
public object plurals
|
||
|
|
||
2 months ago
|
public object font
|
||
|
}
|