Verified Commit 72bd5532 authored by AtjonTV's avatar AtjonTV

extensions: String.openFFDB to use String as filePath

parent 3a78033a
......@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `objectInputStream` extension for File
- FFDB (FlatFile DataBase) (`klib.ffdb.FFDB`)
- IncompatibleDatabaseException (`klib.exceptions.IncompatibleDatabaseException`)
- `openFFDB` extension for String
### Changed
- Upgraded Kotlin from 1.3.61 to 1.3.70
### Deprecated
......
......@@ -5,9 +5,11 @@ import java.io.FileInputStream
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.util.Base64
import klib.annotations.Experimental
import klib.encoding.base.Base58e
import klib.exceptions.InvalidValueException
import klib.exceptions.RequireValueException
import klib.ffdb.FFDB
import klib.hash.Sha1
import klib.hash.Sha256
import klib.kLibInf
......@@ -415,3 +417,14 @@ infix fun String?.asLongOr(or: Long): Long {
infix fun String?.asLongOr(or: Int): Long {
return this.orEmpty().toLongOrNull() ?: or.toLong()
}
/**
* Open a String as a FFDB File
*
* @param version FFDB File Version (Default is V2)
*
* @since 5.0.0
* @author Thomas Obernosterer
*/
@OptIn(Experimental::class)
fun String.openFFDB(version: FFDB.Version = FFDB.Version.V2) = FFDB.open(this, version.version)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment