Class FileResource

java.lang.Object
dev.enola.common.io.resource.BaseResource
dev.enola.common.io.resource.FileResource
All Implemented Interfaces:
AbstractResource, ReadableResource, Resource, WritableResource

public class FileResource extends BaseResource implements Resource
Resource for a file (not a directory) at a Path on a FileSystem.

Note that a Path object instance is associated to a FileSystem, see Path.getFileSystem(). But in its text-form (Path.of(String, String...) and Path.toString()) this association is lost, and it should thus be avoided. In its URI-form (Path.of(URI) and Path.toUri()) this is preserved; typically via the "scheme" (and possibly the "authority") component/s of an URI. So a path in text does not identify a filesystem, whereas an URI can. While the "file:" scheme is obviously the most well-known and common one, the JVM actually can and does support others, notably the "jar:file:" one. To avoid related confusions, this class intentionally only offers constructors which take URI instead of Path (or exposing File) arguments.