Class FileProtocolHandler
java.lang.Object
com.thecsdev.common.resource.protocol.FileProtocolHandler
- All Implemented Interfaces:
ProtocolHandler
A
ProtocolHandler implementation for handling "file" protocol URIs.
This handler reads files from the local filesystem and returns their contents
as ResourceResponse objects.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FileProtocolHandlerThe main singleton instance ofFileProtocolHandler. -
Method Summary
Modifier and TypeMethodDescriptionfinal @NotNull CompletableFuture<ResourceResponse> handle(@NotNull ResourceRequest request) Handles the givenResourceRequestand returns aCompletableFuturethat will complete with aResourceResponse.final booleanDetermines if thisProtocolHandlercan handle the givenURI.
-
Field Details
-
INSTANCE
The main singleton instance ofFileProtocolHandler.
-
-
Method Details
-
matches
Description copied from interface:ProtocolHandlerDetermines if thisProtocolHandlercan handle the givenURI.- Specified by:
matchesin interfaceProtocolHandler- Parameters:
uri- The URI to check.- Returns:
trueif this handler can process the URI;falseotherwise.
-
handle
@NotNull public final @NotNull CompletableFuture<ResourceResponse> handle(@NotNull @NotNull ResourceRequest request) Description copied from interface:ProtocolHandlerHandles the givenResourceRequestand returns aCompletableFuturethat will complete with aResourceResponse.- Specified by:
handlein interfaceProtocolHandler- Parameters:
request- TheResourceRequestto handle.
-