Package io.vertx.core.spi.file
Interface FileResolver
-
- All Superinterfaces:
AutoCloseable
,Closeable
public interface FileResolver extends Closeable
Sometimes the file resources of an application are bundled into jars, or are somewhere on the classpath but not available on the file system, e.g. in the case of a Vert.x webapp bundled as a fat jar.In this case we want the application to access the resource from the classpath as if it was on the file system.
We can do this by looking for the file on the classpath, and if found, copying it to a temporary cache directory on disk and serving it from there.
There is one cache dir per Vert.x instance which is deleted on Vert.x shutdown.
- Author:
- Tim Fox, Rob Worsnop
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close this file resolver, this is a blocking operation.static FileResolver
fileResolver(FileSystemOptions options)
Create a file resolver.File
resolveFile(String fileName)
Resolve the file for the specifiedfileName
.
-
-
-
Method Detail
-
fileResolver
static FileResolver fileResolver(FileSystemOptions options)
Create a file resolver.- Parameters:
options
- the fs options- Returns:
- the file resolver
-
resolveFile
File resolveFile(String fileName)
Resolve the file for the specifiedfileName
. This method should never returnnull
, it can return a file that does not exist.- Parameters:
fileName
- the name to resolve- Returns:
- a file resolved
-
close
void close() throws IOException
Close this file resolver, this is a blocking operation.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-