Package nl.siegmann.epublib.epub
Class ResourcesLoader
- java.lang.Object
-
- nl.siegmann.epublib.epub.ResourcesLoader
-
public class ResourcesLoader extends java.lang.ObjectLoads Resources from inputStreams, ZipFiles, etc
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description ResourcesLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static ZipEntrygetNextZipEntry(ZipInputStream zipInputStream)static ResourcesloadResources(ZipFile zipFile, java.lang.String defaultHtmlEncoding)Loads all entries from the ZipInputStream as Resources.static ResourcesloadResources(ZipFile zipFile, java.lang.String defaultHtmlEncoding, java.util.List<MediaType> lazyLoadedTypes)Loads the entries of the zipFile as resources.static ResourcesloadResources(ZipInputStream zipInputStream, java.lang.String defaultHtmlEncoding)Loads all entries from the ZipInputStream as Resources.private static booleanshouldLoadLazy(java.lang.String href, java.util.Collection<MediaType> lazilyLoadedMediaTypes)Whether the given href will load a mediaType that is in the collection of lazilyLoadedMediaTypes.
-
-
-
Method Detail
-
loadResources
public static Resources loadResources(ZipFile zipFile, java.lang.String defaultHtmlEncoding, java.util.List<MediaType> lazyLoadedTypes) throws java.io.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:
java.io.IOException
-
shouldLoadLazy
private static boolean shouldLoadLazy(java.lang.String href, java.util.Collection<MediaType> lazilyLoadedMediaTypes)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, java.lang.String defaultHtmlEncoding) throws java.io.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:
java.io.IOException
-
getNextZipEntry
private static ZipEntry getNextZipEntry(ZipInputStream zipInputStream) throws java.io.IOException
- Throws:
java.io.IOException
-
loadResources
public static Resources loadResources(ZipFile zipFile, java.lang.String defaultHtmlEncoding) throws java.io.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:
java.io.IOException
-
-