All Projects → terl → resource-loader

terl / resource-loader

Licence: MIT license
Getting files out of a JAR or loading a shared library is difficult. We made it easy.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to resource-loader

Jcoder
Java Dynamic code or JAR , publish you Api or Schedule in flying
Stars: ✭ 137 (+813.33%)
Mutual labels:  jar
AMProgressHUD
A gif progress HUD for iOS.
Stars: ✭ 18 (+20%)
Mutual labels:  loading
ember-await
Await component for Ember Applications. Resolve your data on demand, just when needed.
Stars: ✭ 54 (+260%)
Mutual labels:  loading
Buildjar
通用的打包jar gradle插件
Stars: ✭ 147 (+880%)
Mutual labels:  jar
Miraiandroid
QQ机器人 /(实验性)在Android上运行Mirai-console,支持插件
Stars: ✭ 188 (+1153.33%)
Mutual labels:  jar
respinner
Pretty and customizable svg spinners for React.js
Stars: ✭ 89 (+493.33%)
Mutual labels:  loading
Apk Changer
Command line program for modifying apk files
Stars: ✭ 122 (+713.33%)
Mutual labels:  jar
Liberg
A high-performance and lightweight suites for spring-boot-based web developing.
Stars: ✭ 43 (+186.67%)
Mutual labels:  jar
Swipeactionadapter
The Mailbox-like Swipe gesture library for Android
Stars: ✭ 217 (+1346.67%)
Mutual labels:  jar
react-bones
💀 Dead simple content loading components for React and React-Native. 💀
Stars: ✭ 42 (+180%)
Mutual labels:  loading
Java Markdown Generator
Java library to generate markdown
Stars: ✭ 159 (+960%)
Mutual labels:  jar
Universaljavaapplicationstub
universalJavaApplicationStub - an alternative Application launcher script for Java based macOS Apps that works with both Apple's and Oracle's PList format and supports the old Apple Java 6 as well as all the latest Oracle/OpenJDK/Adopt/Corretto JRE's/JDK's. Plus it supports drag&drop to the Dock icon 🎉
Stars: ✭ 174 (+1060%)
Mutual labels:  jar
ASkyBlock
Rebranded and rebased version of ASkyBlock for NukkitX Minecraft Bedrock Edition!
Stars: ✭ 38 (+153.33%)
Mutual labels:  jar
Java Rpg Maker Mv Decrypter
You can decrypt whole RPG-Maker MV Directories with this Program, it also has a GUI.
Stars: ✭ 142 (+846.67%)
Mutual labels:  jar
ZXLoadingView
🍕ZXLoadingView is an iOS progress-activity
Stars: ✭ 14 (-6.67%)
Mutual labels:  loading
Gradle Nexus Staging Plugin
Automatize releasing Gradle projects to Maven Central.
Stars: ✭ 132 (+780%)
Mutual labels:  jar
react-native-whc-loading
A react native module to show loading ui, it works on iOS and Android.
Stars: ✭ 32 (+113.33%)
Mutual labels:  loading
flutter easyloading
✨A clean and lightweight loading/toast widget for Flutter, easy to use without context, support iOS、Android and Web
Stars: ✭ 1,021 (+6706.67%)
Mutual labels:  loading
PocList
Alibaba-Nacos-Unauthorized/ApacheDruid-RCE_CVE-2021-25646/MS-Exchange-SSRF-CVE-2021-26885/Oracle-WebLogic-CVE-2021-2109_RCE/RG-CNVD-2021-14536/RJ-SSL-VPN-UltraVires/Redis-Unauthorized-RCE/TDOA-V11.7-GetOnlineCookie/VMware-vCenter-GetAnyFile/yongyou-GRP-U8-XXE/Oracle-WebLogic-CVE-2020-14883/Oracle-WebLogic-CVE-2020-14882/Apache-Solr-GetAnyFile/F5…
Stars: ✭ 1,004 (+6593.33%)
Mutual labels:  jar
guide-to-async-components
📖 Guide To JavaScript Async Components
Stars: ✭ 79 (+426.67%)
Mutual labels:  loading

Resource Loader

Resource Loader gives you the functions to load resource files even if you are loading from inside a JARs or outside a JAR. Resource Loader also supports loading shared libraries through SharedLibraryLoader.

Checks

Installation

This is how to install the library in Gradle based projects.

// Top-level build.gradle
repositories {
    // ...
    mavenCentral()
}

dependencies {
    // ...
    implementation 'com.goterl:resource-loader:2.0.2' // Add this line
}

Usage

Loading a file

Let's say you have a file in your resources folder called test1.txt. To get it you simply do the following:

File file = FileLoader.get().load("test1.txt");

Resource Loader can also load from paths and directories. Just make sure the top level directory name is somewhat unique:

// The following loads test1.txt from the resources folder
// even if you supply a nested path.
File file2 = FileLoader.get().load("a_unique_top_level_folder/path/test1.txt");

// You can even load whole directories.
File dir = FileLoader.get().load("a_unique_top_level_folder/directory"); 

Loading a shared library

Loading a shared library is just as simple. You can load one by using loadSystemLibrary which loads a shared library if it is already installed on the system.

// Load from the system
SharedLibraryLoader.get().loadSystemLibrary("hydrogen", Hydrogen.class);

Or you can use load which loads a shared library even if it is bundled inside a JAR or not.

// Load from the system
SharedLibraryLoader.get().load("hydrogen", Hydrogen.class);

What problem does Resource Loader solve?

Consider the scenario. You have a project with some files in the resource folder. You're loading those files using getResourceAsStream and it's working when you test it locally. But when you go to package the project as a JAR and then run it, it fails!

Resource Loader provides developers with a fool-proof way of loading files inside or outside JARs by loading the files in a temporary folder that is deleted when the corresponding Java process that created that temp process has been destroyed.

Here are some features of Resource Loader:

  • Can be used in Android and Java projects.
  • Load from nested JARs up to 20 levels deep.
  • Resource Loader works with shared libraries (.dll, .so, .dylib) and can initialise them.
  • Can extract regular files from the resources folder.
  • Simple include this library and use the .load functions.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].