Package nl.siegmann.epublib.epub
Class ResourcesLoader
java.lang.Object
nl.siegmann.epublib.epub.ResourcesLoader
Loads Resources from inputStreams, ZipFiles, etc
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ZipEntrygetNextZipEntry(ZipInputStream zipInputStream) static ResourcesloadResources(ZipFile zipFile, String defaultHtmlEncoding) Loads all entries from the ZipInputStream as Resources.static ResourcesloadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) Loads the entries of the zipFile as resources.static ResourcesloadResources(ZipInputStream zipInputStream, String defaultHtmlEncoding) Loads all entries from the ZipInputStream as Resources.private static booleanshouldLoadLazy(String href, Collection<MediaType> lazilyLoadedMediaTypes) Whether the given href will load a mediaType that is in the collection of lazilyLoadedMediaTypes.
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG
-
-
Constructor Details
-
ResourcesLoader
public ResourcesLoader()
-
-
Method Details
-
loadResources
public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) throws IOException Loads the entries of the zipFile as resources. The MediaTypes that are in the lazyLoadedTypes will not get their contents loaded, but are stored as references to entries into the ZipFile and are loaded on demand by the Resource system.- Parameters:
zipFile-defaultHtmlEncoding-lazyLoadedTypes-- Returns:
- Throws:
IOException
-
shouldLoadLazy
Whether the given href will load a mediaType that is in the collection of lazilyLoadedMediaTypes.- Parameters:
href-lazilyLoadedMediaTypes-- Returns:
- Whether the given href will load a mediaType that is in the collection of lazilyLoadedMediaTypes.
-
loadResources
public static Resources loadResources(ZipInputStream zipInputStream, String defaultHtmlEncoding) throws IOException Loads all entries from the ZipInputStream as Resources. Loads the contents of all ZipEntries into memory. Is fast, but may lead to memory problems when reading large books on devices with small amounts of memory.- Parameters:
zipInputStream-defaultHtmlEncoding-- Returns:
- Throws:
IOException
-
getNextZipEntry
- Throws:
IOException
-
loadResources
public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding) throws IOException Loads all entries from the ZipInputStream as Resources. Loads the contents of all ZipEntries into memory. Is fast, but may lead to memory problems when reading large books on devices with small amounts of memory.- Parameters:
zipFile-defaultHtmlEncoding-- Returns:
- Throws:
IOException
-