summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-topology/src
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-05-07 12:33:39 +0200
committerGitHub <noreply@github.com>2024-05-07 12:33:39 +0200
commitad20465a5df47b49561bb0afbdda5cd65c5da4b8 (patch)
tree268f0fde5924b71ca2750dbbbba4cbe24c361f12 /opendc-compute/opendc-compute-topology/src
parent7c0691eb6c348d2e49da3ef354b652cf26604905 (diff)
Revamped failure models (#228)
Diffstat (limited to 'opendc-compute/opendc-compute-topology/src')
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt12
1 files changed, 7 insertions, 5 deletions
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt
index 63719c0a..f374b71f 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt
@@ -28,17 +28,19 @@ import kotlinx.serialization.json.decodeFromStream
import org.opendc.compute.topology.specs.TopologySpec
import java.io.File
import java.io.InputStream
+import java.nio.file.Path
+import kotlin.io.path.inputStream
/**
* A helper class for reading a topology specification file.
*/
public class TopologyReader {
- @OptIn(ExperimentalSerializationApi::class)
- public fun read(file: File): TopologySpec {
- val input = file.inputStream()
- val obj = Json.decodeFromStream<TopologySpec>(input)
+ public fun read(path: Path): TopologySpec {
+ return read(path.inputStream())
+ }
- return obj
+ public fun read(file: File): TopologySpec {
+ return read(file.inputStream())
}
/**