Package com.codingchili.core.files
Class Resource
java.lang.Object
com.codingchili.core.files.Resource
Reads a file from the filesystem or the classpath.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionOptional<io.vertx.core.buffer.Buffer>
read()
Reads a file from the filesystem or the classpath.Optional<io.vertx.core.buffer.Buffer>
Reads a resource from the classpath.Optional<io.vertx.core.buffer.Buffer>
Reads a resource from the filesystem.void
write(io.vertx.core.buffer.Buffer buffer)
-
Constructor Details
-
Resource
Creates a new resource reference.- Parameters:
path
- path to the resource (classpath or file.)
-
-
Method Details
-
read
Reads a file from the filesystem or the classpath. Prefers resources on the filesystem as bundled files on the classpath may be overriden.- Returns:
- a buffer if found on the classpath or filesystem.
-
write
public void write(io.vertx.core.buffer.Buffer buffer) -
readFromFS
Reads a resource from the filesystem.- Returns:
- a buffer if the file is loaded successfully.
-
readFromCP
Reads a resource from the classpath.- Returns:
- a buffer if the classpath resource is loaded successfully
-