Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #70 from TheFruxz/feature/resourcesAccess
Browse files Browse the repository at this point in the history
Added sources functions
  • Loading branch information
TheFruxz authored Nov 17, 2021
2 parents 9abfe1f + e064825 commit 80c7613
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions JET-Native/src/main/kotlin/de/jet/library/extension/File.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@file:Suppress("NOTHING_TO_INLINE")

package de.jet.library.extension

inline fun getResourceText(resource: String) =
object {}.javaClass.getResource(resource)?.readText() ?: throw NoSuchElementException("Resource $resource not found")

inline fun getResourceByteArray(resource: String) =
object {}.javaClass.getResource(resource)?.readBytes() ?: throw NoSuchElementException("Resource $resource not found")

0 comments on commit 80c7613

Please sign in to comment.