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

com.worldturner.test.util.getResource.kt Maven / Gradle / Ivy

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")
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy