@@ -4,22 +4,26 @@ This library provides a simple file system to access the contents modules in a u
4
4
5
5
## Motivation
6
6
7
- Since version 1.7, Java provides the
8
- [ FileSystem] ( https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html ) and
9
- [ Path] ( https://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html ) classes, which make working with files much easier.
10
-
11
- However, to reliably access resources in a package of a jar, or now a module, you still have to use the old methods
12
- [ getResource()] ( https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Class.html#getResource(java.lang.String) ) and
13
- [ getResourceAsStream()] ( https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Class.html#getResourceAsStream(java.lang.String) ) ,
14
- because modules can be stored in different formats:
7
+ The [ Path] ( https://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html ) and
8
+ [ FileSystem] ( https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html ) APIs
9
+ introduced in Java 1.7 with NIO.2 makes working with files much more pleasant.
10
+ One hurdle when trying to use these APIs with bundled application resources is that modules can be stored in different formats:
15
11
- Exploded module directory, stored as directory tree (Used during development)
16
12
- Module artifacts, mostly stored as jars (Used for both development and production)
17
- - Modules contained in a JLink image in a proprietary jimage format (Only used for production)
13
+ - Modules contained in a jlink image, which are stored in a proprietary jimage format (Only used for production)
18
14
19
- While there are FileSystem implementations like jdk.zipfs for jar files and the internal jrtfs for jimage modules ,
20
- there is no unified interface and you have to take care of FileSystem specific differences like ... and closeabilty.
15
+ While there are FileSystem implementations like jdk.zipfs for jar files and the internal jrtfs for jlink images ,
16
+ there is no unified interface, which results in you having to take care of FileSystem specific differences like ... and closeabilty.
21
17
As a result, how to access files in modules using FileSystems depends on how the modules are stored
22
18
and can therefore vary between development and production environments.
19
+ The current solution to reliably access resources in a package of a jar, or now a module, is to use the old methods
20
+ [ getResource()] ( https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Class.html#getResource(java.lang.String) ) and
21
+ [ getResourceAsStream()] ( https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Class.html#getResourceAsStream(java.lang.String) ) .
22
+ These methods are however way more tedious to work with.
23
+
24
+
25
+
26
+
23
27
24
28
## Features
25
29
0 commit comments