summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/blueprint-core
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-25 00:31:16 -0400
committerAlexis de Talhouƫt <adetalhouet89@gmail.com>2019-03-25 14:31:26 -0400
commit40e79084751b4ef3b6d69189f1edf947fb6af011 (patch)
treeff9d4bef034580a73687114449a00a102d667f81 /ms/controllerblueprints/modules/blueprint-core
parent3a2872a0d9c01bde8aabcc35d79b40f6c03f1958 (diff)
Improve initial data load
Change-Id: I5358b4a4900858bfefea429cf0a1e260d2dcd19a Issue-ID: CCSDK-1137 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
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.kt10
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())
+}