mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-25 01:57:15 +00:00
37 lines
660 B
Kotlin
37 lines
660 B
Kotlin
package dev.inmo.micro_utils.common
|
|
|
|
import okio.FileSystem
|
|
import okio.Path
|
|
import okio.use
|
|
|
|
actual typealias MPPFile = Path
|
|
|
|
/**
|
|
* @suppress
|
|
*/
|
|
actual val MPPFile.filename: FileName
|
|
get() = FileName(toString())
|
|
/**
|
|
* @suppress
|
|
*/
|
|
actual val MPPFile.filesize: Long
|
|
get() = FileSystem.SYSTEM.openReadOnly(this).use {
|
|
it.size()
|
|
}
|
|
/**
|
|
* @suppress
|
|
*/
|
|
actual val MPPFile.bytesAllocatorSync: ByteArrayAllocator
|
|
get() = {
|
|
FileSystem.SYSTEM.read(this) {
|
|
readByteArray()
|
|
}
|
|
}
|
|
/**
|
|
* @suppress
|
|
*/
|
|
actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator
|
|
get() = {
|
|
bytesAllocatorSync()
|
|
}
|