-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a resource conversion to read internal files when deployed as a…
… jar file
- Loading branch information
Nikollai
committed
May 26, 2026
1 parent
fbd0d66
commit a61978a
Showing
3 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/millions/controller/fileIO/CSV/InternalResourceUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package millions.controller.fileIO.CSV; | ||
|
|
||
| import java.io.File; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.StandardCopyOption; | ||
|
|
||
| public class InternalResourceUtil { | ||
| public File getFileFromJar(InputStream resource) throws IOException { | ||
| if (resource == null) { | ||
| throw new IOException("Resource not found is null"); | ||
| } | ||
| File tempFile = File.createTempFile("javafx_app_", ".tmp"); | ||
| tempFile.deleteOnExit(); | ||
| Files.copy(resource, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); | ||
| return tempFile; | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters