Package dev.enola.common.io.resource
Class FileResource
java.lang.Object
dev.enola.common.io.resource.BaseResource
dev.enola.common.io.resource.FileResource
- All Implemented Interfaces:
AbstractResource,ReadableResource,Resource,WritableResource
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.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class dev.enola.common.io.resource.BaseResource
mediaType, uriFields inherited from interface dev.enola.common.io.resource.ReadableResource
LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionFileResource(URI uri, MediaType mediaType, OpenOption... openOptions) FileResource(URI uri, OpenOption... openOptions) -
Method Summary
Methods inherited from class dev.enola.common.io.resource.BaseResource
mediaType, toString, uriMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.enola.common.io.resource.AbstractResource
mediaType, uriMethods inherited from interface dev.enola.common.io.resource.ReadableResource
changeToken, charSource, isDifferent, isDifferentMethods inherited from interface dev.enola.common.io.resource.WritableResource
charSink
-
Constructor Details
-
FileResource
-
FileResource
-
-
Method Details
-
byteSink
- Specified by:
byteSinkin interfaceWritableResource
-
byteSource
- Specified by:
byteSourcein interfaceReadableResource
-