withResource

fun <R> withResource(url: String, block: (InputStream) -> R): R(source)

Reads a resource relative from the calling class.

If the URL starts with a /, then the resource will be read from the root, so either the JAR root, or from your resources directory.

If the URL does not start with a /, then it is read relative to the package of the calling class.