Package org.oscim.theme
Class ZipXmlThemeResourceProvider
java.lang.Object
org.oscim.theme.ZipXmlThemeResourceProvider
- All Implemented Interfaces:
XmlThemeResourceProvider
Resource provider reading resource files out of a zip input stream.
Resources are cached.
-
Constructor Summary
ConstructorsConstructorDescriptionZipXmlThemeResourceProvider(ZipInputStream zipInputStream) ZipXmlThemeResourceProvider(ZipInputStream zipInputStream, int maxResourceSizeToCache) -
Method Summary
Modifier and TypeMethodDescriptioncreateInputStream(String relativePath, String source) intgetCount()scanXmlThemes(ZipInputStream zipInputStream) Scans a given zip stream for contained xml themes without actually reading and storing its content in memory.
-
Constructor Details
-
ZipXmlThemeResourceProvider
- Parameters:
zipInputStream- zip stream to read resources from- Throws:
IOException- if a problem occurs reading the stream
-
ZipXmlThemeResourceProvider
public ZipXmlThemeResourceProvider(ZipInputStream zipInputStream, int maxResourceSizeToCache) throws IOException - Parameters:
zipInputStream- zip stream to read resources frommaxResourceSizeToCache- only resources in the zip stream with a maximum size of this parameter (in bytes) are cached and provided- Throws:
IOException- if a problem occurs reading the stream
-
-
Method Details
-
createInputStream
- Specified by:
createInputStreamin interfaceXmlThemeResourceProvider- Parameters:
relativePath- a relative path to use as a base for search in the resource provuidersource- a source string parsed out of an XML render theme "src" attribute.- Returns:
- an InputStream to read the resource data from.
-
getCount
public int getCount()- Returns:
- the number of files in the archive.
-
getXmlThemes
- Returns:
- the XML theme paths in the archive.
-
scanXmlThemes
Scans a given zip stream for contained xml themes without actually reading and storing its content in memory.This method is useful to find out which xml themes are available across multiple zip files without actually have to read them all into memory.
- Parameters:
zipInputStream- zip stream to read resources from- Returns:
- the XML theme paths in the archive
- Throws:
IOException- if a problem occurs reading the stream
-