com.worldturner.test.util.getResource.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of medeia-validator-test Show documentation
Show all versions of medeia-validator-test Show documentation
Medeia streaming JSON-schema validator for the JVM platform,
test suite.
The newest version!
package com.worldturner.test.util
import java.io.FileNotFoundException
import java.io.InputStream
import java.net.URL
inline fun T.getResourceAsStream(resource: String): InputStream {
val stream = T::class.java.getResourceAsStream(resource)
return stream ?: throw FileNotFoundException("Resource $resource not found")
}
inline fun T.getResourceAsUrl(resource: String): URL {
val stream = T::class.java.getResource(resource)
return stream ?: throw FileNotFoundException("Resource $resource not found")
}