diff options
Diffstat (limited to 'opendc-compute/opendc-compute-topology')
| -rw-r--r-- | opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyReader.kt | 12 |
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()) } /** |
