From ad20465a5df47b49561bb0afbdda5cd65c5da4b8 Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Tue, 7 May 2024 12:33:39 +0200 Subject: Revamped failure models (#228) --- .../kotlin/org/opendc/compute/topology/TopologyReader.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'opendc-compute/opendc-compute-topology/src') 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(input) + public fun read(path: Path): TopologySpec { + return read(path.inputStream()) + } - return obj + public fun read(file: File): TopologySpec { + return read(file.inputStream()) } /** -- cgit v1.2.3