diff options
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core')
-rw-r--r-- | ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt index b9d80b301..6744b625e 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt @@ -16,10 +16,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import org.apache.commons.io.FileUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils import java.io.File import java.io.InputStream +import java.nio.charset.Charset import java.nio.file.Path import java.nio.file.Paths @@ -81,3 +84,10 @@ fun normalizedPathName(path: String, vararg more: String?): String { return normalizedPath(path, *more).toString() } +suspend fun File.readNBText(): String = withContext(Dispatchers.IO) { + readText(Charset.defaultCharset()) +} + +suspend fun File.readNBLines(): List<String> = withContext(Dispatchers.IO) { + readLines(Charset.defaultCharset()) +} |