PathBasedImageLoader
floodsim.view.util.resource.PathBasedImageLoader
final class PathBasedImageLoader[K](mapping: Map[K, String]) extends ResourceLoader[K, BufferedImage]
Loads images from classpath resources based on a key-to-path mapping. Uses the current classloader to resolve mapping(key) into a resource stream and decodes it via ImageIO.read, returning detailed ResourceError values on failure. Error semantics:
- ResourceError.InvalidKey if the provided key is not present in the mapping
- ResourceError.NotFound if the classpath resource cannot be found
- ResourceError.Unreadable if the resource cannot be decoded as an image
Type parameters
- K
-
key type
Value parameters
- mapping
-
association between keys and classpath resource paths
Attributes
- Graph
-
- Supertypes
Members list
In this article