All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.openapiprocessor.test.stream.Memory.kt Maven / Gradle / Ivy

There is a newer version: 2024.6.1
Show newest version
/*
 * Copyright 2020 https://github.com/openapi-processor/openapi-processor-test
 * PDX-License-Identifier: Apache-2.0
 */

package io.openapiprocessor.test.stream

/**
 * in-memory content by path.
 */
class Memory {
    companion object {
        private val contents: MutableMap = mutableMapOf()

        fun get(path: String): ByteArray? {
            return contents[path]
        }

        @JvmStatic
        fun add(path: String, data: String) {
            add(path, data.toByteArray())
        }

        fun add(path: String, data: ByteArray) {
            contents[path] = data
        }

        fun clear() {
            contents.clear()
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy