Package net.targetr.wtm3.io.loader
Class ZipFileResourceLoader
java.lang.Object
net.targetr.wtm3.io.loader.ZipFileResourceLoader
- All Implemented Interfaces:
ResourceLoader
Loads resources from a ZIP file into memory-backed streams.
-
Constructor Summary
ConstructorsConstructorDescriptionZipFileResourceLoader(File zipFile, int maxSizeBytes) Constructs a ZipFileResourceLoader with the specified resource size limit. -
Method Summary
Modifier and TypeMethodDescriptiongetName()Returns the path to the ZIP file used by this loader.Returns the resource source.openInputStream(String path) Opens a resource stream.
-
Constructor Details
-
ZipFileResourceLoader
Constructs a ZipFileResourceLoader with the specified resource size limit.- Parameters:
zipFile- the zip file to read resources frommaxSizeBytes- maximum size in bytes of a single resource to be loaded
-
-
Method Details
-
getName
Returns the path to the ZIP file used by this loader.- Returns:
- the path to the zip.
-
openInputStream
Description copied from interface:ResourceLoaderOpens a resource stream. The caller is responsible for closing the returned stream.- Specified by:
openInputStreamin interfaceResourceLoader- Parameters:
path- the resource path understood by this loader- Returns:
- a stream containing the resource data, or null if the resource is not found
- Throws:
IOException- if opening or reading the resource fails
-
getSource
Description copied from interface:ResourceLoaderReturns the resource source.- Specified by:
getSourcein interfaceResourceLoader- Returns:
- a string representing the source resources are loaded from
-